Jay Burgess wrote:
I have a form field on my JSP that's being conditionally displayed based on the
status of servlet context attribute:
<logic:equal name="mode" value="<%=Globals.REQUIRED%>">
<html:text property="myField" size="15" />
</logic:equal>
I'm using the Struts validator to validate this field:
<field property="myField" depends="required,mask,maxlength">
...
</field>
Obviously, I only want the client-side Javascript validations to fire if the
field is present.
Is there a way in VALIDATION.XML to conditionally include/exclude the Javascript
validations, so they don't fire if the field isn't present? (They're currently
firing and failing, stopping the other client-side validations as well.)
Well, you've declared the field as 'required', so it's being, er,
required... Remove the 'required' rule and, if you want to still make it
required in some circumstances, use the validwhen rule [1].
L.
[1]
http://struts.apache.org/struts-doc-1.2.x/userGuide/dev_validator.html#validwhen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]