cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Ochs <dan.o...@gmail.com>
Subject [CFORM] How can I remove a previous validation error from a widget?
Date Thu, 04 Aug 2005 00:20:11 GMT
Hi everyone, I'm trying to do some javascript validation with my form
that validates that at least one out of two fields are filled in.  I
put the validation element and javascript under the form element and
the validation works fine the first time I execute it.  In the
validation code I set the validation error on the SECOND of the two
widgets.

If I try to submit the form without filling in any data the first
time, the validation works fine.  Then if I fix the problem by filling
in some data in the FIRST field and resubmit, the validation still
fails.  If I fix the problem by filling in some data in the SECOND
field and resubmit, the validtion works correctly.  So, I think what I
need to do is clear the validation error from the SECOND field, but
I'm not sure how to do this.

I set the error on the field by doing:
if (isvalid==false){
   form.lookupWidget("fieldId").setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("error_key",true)));
}

I have tried removing the validation error by doing this, and the
validation error is removed, but the form does not submit and I get
the page back again, but without any errors. (So I have to click
submit twice after the error is fixed)
else{
   form.lookupWidget("fieldId").setValidationError(null);
}


Anyone have any suggestions of how to implement this or a way I should
reorganize my form to get this to work properly?

thanks!
dan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message