You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by rama chandrula <rc...@hotmail.com> on 2006/01/23 09:44:32 UTC
validating a single textbox for two mask values
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>
_________________________________________________________________
NRIs, Free Money Transfers to over 30 Million Visa Cards in India.
http://creative.mediaturf.net/creatives/icicibank/MSN_VISA_TOL.htm
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: validating a single textbox for two mask values
Posted by rama chandrula <rc...@hotmail.com>.
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 <la...@holoweb.net>
>Reply-To: "Struts Users Mailing List" <us...@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: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Spice up your IM conversations. New, colorful and animated emoticons. Get
chatting! http://server1.msn.co.in/SP05/emoticons/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: validating a single textbox for two mask values
Posted by Laurie Harper <la...@holoweb.net>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org