Closed Thread Icon

Topic awaiting preservation: Help verify two fields (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=25983" title="Pages that link to Topic awaiting preservation: Help verify two fields (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Help verify two fields <span class="small">(Page 1 of 1)</span>\

 
AT
Bipolar (III) Inmate

From: Gainesboro, TN, USA
Insane since: Aug 2000

posted posted 06-07-2005 20:00

I have a form, two of the fields need to have a certain format.

One field has to be numeric, in either of these two formats. 00-0000 or 0000-0000
The second has to be a telephone number in this format 000-000-0000

Can someone give me a hand? I forgot all about this.

Thank you

Casey / AT
Personal
Song Lyrics
Family Recipes

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-07-2005 21:10

I don't know if you know how to validate via javascript from a form. But you can google that aspect.

For this you can use something like so:


pat1 = /^\d{2,4}-\d{4}$/
pat2 = /^\d{3}-\d{3}-\d{4}$/

if (pat1.test( firstInput ) ) { alert( "Field Matches" ) }
if ( pat2.test(phoneNumberInput) ) alert( "Phone Number Okay" );

I've seen JS tricks that auto format input which you can also use but they're more complicated.



.:[ Never resist a perfect moment ]:.

AT
Bipolar (III) Inmate

From: Gainesboro, TN, USA
Insane since: Aug 2000

posted posted 06-07-2005 21:15

haha I was coming back to say that I figured it out

Thank you bit, your time as always is very much appreciated.

Casey / AT
Personal
Song Lyrics
Family Recipes

« BackwardsOnwards »

Show Forum Drop Down Menu