You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ugachaka <ug...@amigo.lv> on 2007/06/13 10:05:54 UTC

Struts validator "maskif"

Hi. I am wondering is there really a validation attribute "maskif".
I one forum, i read that i just need to add the following lines to my
validation-rules and validation xml files and it will work- 

<validator name="validif"
classname="validation.ValidIf"
method="validateValidIf"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.commons.validator.Validator"/>

<validator name="maskif"
classname="org.apache.struts.validator.FieldChecks"
method="validateMask"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
depends="validif"
msg="errors.invalid"/>


<field property="zipcode" depends="maskif">
<arg key="validWhenForm.lastName" />
<var>
<var-name>mask</var-name>
<var-value>^\d{5}$</var-value>
</var>
<var>
<var-name>check</var-name>
<var-value>(country=='US')</var-value>
</var>
</field>

but i DOESN'T!! :(
even more - without this attribute, everything ir working fine (mask,
requiredif, email..etc)
but when i add the  lines above to my validation.xml, the others validator
rules are not working any more! It doesn't validate not required not even
other fields.
I am already stuck in this for few days, so i smb could help! 
-- 
View this message in context: http://www.nabble.com/Struts-validator-%22maskif%22-tf3913143.html#a11094652
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org