Hide
invoking DWRUtil.getValues("someFormId") return a mapping with a strange choice of keys.
A form, when submit using browser is a list of 'name=value' entries but DWRUtil does not take into account the name of elements. When you 'dump' a form using getValues you get a mapping in the form 'id=value' or, worse, if no id are defined, in the form 'value=value'.
Looking at .js code i see what seems to me like a typo, as value=value in response is a nonsense:
for (var i = 0; i < ele.elements.length; i++) {
if (ele[i].id != null) value = ele[i].id;
else if (ele[i].value != null) value = ele[i].value;
else value = "element" + i;
reply[value] = DWRUtil.getValue(ele[i]);
}
Unless this is corrected this make background sending of form a bit troublesome when you can't use the ids as key (because similar form is present several time in same webpage, i can't give to form element id=name, but i can afford dropping of the id)
The line
else if (ele[i].value != null) value = ele[i].value;
should probably be
else if (ele[i].name != null) value = ele[i].name;
This way, each entry of resulting map is in the form (id or name or elementxyz)=value
Show
invoking DWRUtil.getValues("someFormId") return a mapping with a strange choice of keys.
A form, when submit using browser is a list of 'name=value' entries but DWRUtil does not take into account the name of elements. When you 'dump' a form using getValues you get a mapping in the form 'id=value' or, worse, if no id are defined, in the form 'value=value'.
Looking at .js code i see what seems to me like a typo, as value=value in response is a nonsense:
for (var i = 0; i < ele.elements.length; i++) {
if (ele[i].id != null) value = ele[i].id;
else if (ele[i].value != null) value = ele[i].value;
else value = "element" + i;
reply[value] = DWRUtil.getValue(ele[i]);
}
Unless this is corrected this make background sending of form a bit troublesome when you can't use the ids as key (because similar form is present several time in same webpage, i can't give to form element id=name, but i can afford dropping of the id)
The line
else if (ele[i].value != null) value = ele[i].value;
should probably be
else if (ele[i].name != null) value = ele[i].name;
This way, each entry of resulting map is in the form (id or name or elementxyz)=value