By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,340 Members | 1,715 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,340 IT Pros & Developers. It's quick & easy.

Javascript validation for enter telephone number

P: 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

Nov 17 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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".

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

P: n/a
Randy Webb wrote on 17 nov 2006 in comp.lang.javascript:
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".
... 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)
Nov 17 '06 #3

P: n/a

Sirisha wrote:
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
Jan 9 '07 #4

P: n/a
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 ;-}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 9 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.