Hi Andrew,
Looks like you just need to have cusStyle.setValidationError(null) somewhere in your validation javascript to clear out the error. Maybe something like:
<fd:validation>
<fd:javascript>
var success = true;
var defStyle = widget.lookupWidget("defaultStylesheet");
var cusStyle = widget.lookupWidget("customStylesheet");
cusStyle.setValidationError(null);
if (defStyle.value == 'custom') {
if (cusStyle.value == null) {
cusStyle.setValidationError(new Packages.org.apache.cocoon.forms.validation.ValidationError("You must provide a Custom Stylesheet if the Default Stylesheet is set to Custom.", false));
success = false;
}
}
return success;
</fd:javascript>
</fd:validation>
Andrew MacDonald wrote:
Hello, I'm performing form-level validation and have set an error if the value of an upload widget (customStylesheet) is null. However, the upload widget should only be validated depending on the value of another widget (defaultStylesheet).
Here's my validation code: <fd:validation> <fd:javascript> var success = true; var defStyle = widget.lookupWidget("defaultStylesheet"); if (defStyle.value == 'custom') { var cusStyle = widget.lookupWidget("customStylesheet"); if (cusStyle.value == null) { cusStyle.setValidationError(new Packages.org.apache.cocoon.forms.validation.ValidationError("You must provide a Custom Stylesheet if the Default Stylesheet is set to Custom.", false)); success = false; } } return success; </fd:javascript> </fd:validation>
The problem is that if the user sets the defaultStylesheet to custom, tries to submit the form, and then changes defaultStylesheet to something else, the customStylesheet widget still has that validation error. How can I remove it?
I was looking at the removeValidator method for the AbstractWidget class, but couldn't figure out how to make it work.
Thanks, Andrew
__________________________________ Yahoo! Messenger Show us what our next emoticon should look like. Join the fun. http://www.advision.webevents.yahoo.com/emoticontest
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
