Connecting Tech Pros Worldwide Help | Site Map

Javascript validation for enter telephone number

  #1  
Old November 17th, 2006, 02:45 AM
Sirisha
Guest
 
Posts: n/a
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

  #2  
Old November 17th, 2006, 02:55 AM
Randy Webb
Guest
 
Posts: n/a

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/
  #3  
Old November 17th, 2006, 08:35 AM
Evertjan.
Guest
 
Posts: n/a

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)
  #4  
Old January 9th, 2007, 06:35 AM
rdtiwari7@gmail.com
Guest
 
Posts: n/a

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
  #5  
Old January 9th, 2007, 09:25 AM
Evertjan.
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Numbers only validation using regular expression sreemati answers 4 June 21st, 2007 03:59 PM
Javascript Validation for enter telephone number Sirisha answers 1 November 17th, 2006 03:15 AM
validation of date and set focus problem MickG answers 6 July 23rd, 2005 07:51 PM
javascript form validation which just doesnt work with my ASP code. Can any one help me out please. x muzuo answers 7 July 23rd, 2005 05:37 PM