ContactID and phoneNumber are regualr expressions that are used more than once in the validation.xml and hence are deifned using constants.

From: Laurie Harper <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
To: user@struts.apache.org
Subject: Re: validating a single textbox for two mask values
Date: Mon, 23 Jan 2006 16:45:10 -0500

rama chandrula wrote:
Hi,

I have a text box in which I can either enter a E-mail address or the Phone number. I want to use Struts-Validator for validating the format of both the email and phone number.

How can I specify the values of both the masks for the same text box.
In the snippet given below, contactID is used to refer the email address. Is the following correct ?


<form name="myForm">
           <field property="addContactID"
                  depends="mask">
              <arg0 key="prompt.contactID"/>
              <arg1 key="error.invalid.contactID"/>
              <var>
                  <var-name>mask</var-name>
                  <var-value>(${contactID})|(${phoneNumber})</var-value>
              </var>
           </field>
       </form>

<var-value> should contain a regular expression. I'm not sure what ${contactID} and ${phoneNumber} are, but you need to replace them with the appropriate regular expressions.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Spice up your IM conversations. New, colorful and animated emoticons. Get chatting! http://server1.msn.co.in/SP05/emoticons/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to