hi,
when i replace the provided code with:
for (var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if (e.name != null && e.name != '') {
if(e.type =='checkbox'){
if(e.checked==true)
params[e.name] = e.value;
}else{
params[e.name] = e.value;
}
}
the correct request parameters are being sent and are also getting correctly
validated. Now i am facing a new problem: If there is a single checkbox then
i see field errors being displayed, but if there are multiple checkboxes
then i dont see any field errors. I strongly believe that i am going wrong
some where... any help would be appreciated.
after some debugging i found that an if condition ( if
(form.elements[fieldName].touched) {
12 for (var i = 0; i < errors.fieldErrors[fieldName].length; i++) {
13 addError(form.elements[fieldName], errors.fieldErrors[fieldName][i]);
14 }
15 }) of validations.js failing for multiple checkboxes which is causing the
problem.
i believe that there is some mistake with configuration. any help?
ravi_eze wrote:
>
> hi,
>
> i have 3 checkboxes(c1,c2,c3) enclosed in a form (theme: ajax;
> validate=true). I am trying to get the validation done by ajax and when i
> un-check all boxes or check some of the boxes i see that always c3 is
> being set in request parameter.
>
> when i tried to debug i found the following statement in
> validationClient.js which could be a cause of this behavior:
>
> var vc = this;
> var form = input.form;
> var params = new Object();
> for (var i = 0; i < form.elements.length; i++) {
> var e = form.elements[i];
> if (e.name != null && e.name != '') {
> params[e.name] = e.value;
> }
> }
>
> which is always putting the 3rd checkbox in the request parameter even
> though its not checked. If i remove all ajax related attributes (i.e.
> <s:head, <s:form.. ) the parameters are going right and the validations
> are happening fine.
>
> any ideas where i am going wrong/ is any body else is also getting the
> same behavior?
>
>
--
View this message in context:
http://www.nabble.com/wrong-request-parameters-sent-tp14555088p14557923.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]