You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Reynolds <ji...@gmail.com> on 2007/02/21 19:55:47 UTC

Validate phone question 1.2.9

Best way to validate a phone that has 3 textfields.

Scope wants 3 textfields (areacode, phoneexchange, phone4) on a form.
We need to validate that the phone has all digits in each of the
fields. But upon looking at the docs, I do not see a clean way to
handle this.

I am sure this is done often, and possibly there is a recipe somewhere
for this. Using the validator framework.

Thanks,

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


Re: Validate phone question 1.2.9

Posted by Dave Newton <ne...@yahoo.com>.
So... define three regexps? (Well, two, but you know
what I mean :)

--- Jim Reynolds <ji...@gmail.com> wrote:

> If I am reading you correctly, you are saying to use
> that for one
> field. Which is actually what I just did.
> EG:
> <global>
>     <constant>
>       <constant-name>phone</constant-name>
>       <constant-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-|
> ]?(\d{4})$</constant-value>
>     </constant>
> 
> but the client wants to see 3 textfield boxes
> separated with hyphens,
> etc. So that is where I ran into issues. I was
> trying to ensure that
> textfield1 had 3 digits, then textfield2 had 3
> digits and then
> textfield3 had 4 digits.
> 
> something the client wants. I did fall back to one
> textfield curently
> to move forward. I guess I could write my own
> validator and be done.
> 
> Thanks,
> 
> 
> On 2/21/07, Dave Newton <ne...@yahoo.com>
> wrote:
> > Regexp ("mask") validator?
> >
> >
>
http://struts.apache.org/1.2.9/userGuide/dev_validator.html
> >
> > --- Jim Reynolds <ji...@gmail.com> wrote:
> >
> > > Best way to validate a phone that has 3
> textfields.
> > >
> > > Scope wants 3 textfields (areacode,
> phoneexchange,
> > > phone4) on a form.
> > > We need to validate that the phone has all
> digits in
> > > each of the
> > > fields. But upon looking at the docs, I do not
> see a
> > > clean way to
> > > handle this.
> > >
> > > I am sure this is done often, and possibly there
> is
> > > a recipe somewhere
> > > for this. Using the validator framework.
> > >
> > > Thanks,
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail:
> > > user-help@struts.apache.org
> > >
> > >
> >
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Never miss an email again!
> > Yahoo! Toolbar alerts you the instant new Mail
> arrives.
> >
> http://tools.search.yahoo.com/toolbar/features/mail/
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



 
____________________________________________________________________________________
Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

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


Re: Validate phone question 1.2.9

Posted by Jim Reynolds <ji...@gmail.com>.
If I am reading you correctly, you are saying to use that for one
field. Which is actually what I just did.
EG:
<global>
    <constant>
      <constant-name>phone</constant-name>
      <constant-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$</constant-value>
    </constant>

but the client wants to see 3 textfield boxes separated with hyphens,
etc. So that is where I ran into issues. I was trying to ensure that
textfield1 had 3 digits, then textfield2 had 3 digits and then
textfield3 had 4 digits.

something the client wants. I did fall back to one textfield curently
to move forward. I guess I could write my own validator and be done.

Thanks,


On 2/21/07, Dave Newton <ne...@yahoo.com> wrote:
> Regexp ("mask") validator?
>
> http://struts.apache.org/1.2.9/userGuide/dev_validator.html
>
> --- Jim Reynolds <ji...@gmail.com> wrote:
>
> > Best way to validate a phone that has 3 textfields.
> >
> > Scope wants 3 textfields (areacode, phoneexchange,
> > phone4) on a form.
> > We need to validate that the phone has all digits in
> > each of the
> > fields. But upon looking at the docs, I do not see a
> > clean way to
> > handle this.
> >
> > I am sure this is done often, and possibly there is
> > a recipe somewhere
> > for this. Using the validator framework.
> >
> > Thanks,
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> >
>
>
>
>
> ____________________________________________________________________________________
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives.
> http://tools.search.yahoo.com/toolbar/features/mail/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Validate phone question 1.2.9

Posted by Dave Newton <ne...@yahoo.com>.
Regexp ("mask") validator?

http://struts.apache.org/1.2.9/userGuide/dev_validator.html

--- Jim Reynolds <ji...@gmail.com> wrote:

> Best way to validate a phone that has 3 textfields.
> 
> Scope wants 3 textfields (areacode, phoneexchange,
> phone4) on a form.
> We need to validate that the phone has all digits in
> each of the
> fields. But upon looking at the docs, I do not see a
> clean way to
> handle this.
> 
> I am sure this is done often, and possibly there is
> a recipe somewhere
> for this. Using the validator framework.
> 
> Thanks,
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

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