I pulled this old thread off the archives in order to give context to a
couple of questions....
>And if you want to do a javascript validation on it as well, don't forget
to
>set the <var-jstype> attribute to be regexp in the validation.xml.
Is this a valid tag? I don't see any reference to it in the dtd.
snip
> Then change the validation-rules.xml to add the second mask validator
>
> <validator name="mask2"
> classname="myPackage.MyFieldChecks"
> method="validateMask"
> methodParams="java.lang.Object,
> org.apache.commons.validator.ValidatorAction,
> org.apache.commons.validator.Field,
> org.apache.struts.action.ActionMessages,
> javax.servlet.http.HttpServletRequest"
> depends=""
> msg="errors.mask2"/>
>
For javascript do I need to have a second validateMask function? It looks
like to me that there's a hardcoded "mask" in the code so I would need a
2nd funcion with a hardcoded "mask2".
> Then in your validation.xml, use both the standard mask and your mask2
> validator:
>
> <form name="....">
> <field property="..." depends="mask, mask">
> <var>
>
<var-name>mask</var-name><var-value>^.......$</var-value>
> </var>
> <var>
>
<var-name>mask2</var-name><var-value>^.......$</var-value>
> </var>
> </field>
>
>
>
> ----- Original Message -----
> From: "Berke, Wayne [IT]" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, April 21, 2004 2:03 PM
> Subject: Validation with 2 masks?
>
>
> I'd like to a property validation against 2 different regular expressions
> with 2 different error messages.
>
> This seems like a fairly common use. Is there a best practice for it?
>
> Wayne
>
> ---------------------------------------------------------------------
> 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]
>
---------------------------------------------------------------------
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]