Connecting Tech Pros Worldwide Forums | Help | Site Map

Javascript validation for enter telephone number

Sirisha
Guest
 
Posts: n/a
#1: Nov 17 '06
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


Randy Webb
Guest
 
Posts: n/a
#2: Nov 17 '06

re: Javascript validation for enter telephone number


Sirisha said the following on 11/16/2006 10:05 PM:
Quote:
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".

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Evertjan.
Guest
 
Posts: n/a
#3: Nov 17 '06

re: Javascript validation for enter telephone number


Randy Webb wrote on 17 nov 2006 in comp.lang.javascript:
Quote:
Sirisha said the following on 11/16/2006 10:05 PM:
Quote:
>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".
... and tell us for what country and net you want it dane.

My only "sapcace" has been lost while zapping.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
rdtiwari7@gmail.com
Guest
 
Posts: n/a
#4: Jan 9 '07

re: Javascript validation for enter telephone number



Sirisha wrote:
Quote:
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
Evertjan.
Guest
 
Posts: n/a
#5: Jan 9 '07

re: Javascript validation for enter telephone number


Sirisha wrote on 17 nov 2006 in comp.lang.javascript:
Quote:
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 ;-}


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Closed Thread