Javascript validation for enter telephone number

S

Sirisha

I have one textbox for enter telephone numbers.
i want that text box can accepts only 0 to 9 digits and one sapcace,
-,special characters.

I want Javascript script validation for that text box.





Sirisha
 
R

Randy Webb

Sirisha said the following on 11/16/2006 10:05 PM:
I have one textbox for enter telephone numbers.
i want that text box can accepts only 0 to 9 digits and one sapcace,
-,special characters.

I want Javascript script validation for that text box.

Then write one?

Write *something* and post it. Don't expect someone to write it from
scratch. Search the archives for "phone number validation".
 
E

Evertjan.

Randy Webb wrote on 17 nov 2006 in comp.lang.javascript:
Sirisha said the following on 11/16/2006 10:05 PM:

Then write one?

Write *something* and post it. Don't expect someone to write it from
scratch. Search the archives for "phone number validation".

... and tell us for what country and net you want it dane.

My only "sapcace" has been lost while zapping.
 
R

rdtiwari7

Sirisha said:
I have one textbox for enter telephone numbers.
i want that text box can accepts only 0 to 9 digits and one sapcace,
-,special characters.

I want Javascript script validation for that text box.





Rastra Deep Tiwari
 
E

Evertjan.

Sirisha wrote on 17 nov 2006 in comp.lang.javascript:
I have one textbox for enter telephone numbers.
i want that text box can accepts only 0 to 9 digits and one sapcace,
-,special characters.

I want Javascript script validation for that text box.

Never restrict textbox entry, as this confuses the user,
making a backspace on a typed in character that was rejected,
deleting another one than expected, etc.

Validation is ok, read up on regex.

testResult = !/[\d \-]/.test(tNr)

will test for "not 0123456789 -"

I cannot find a "sapcace" on my keyboard, btw ;-}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top