PDA

View Full Version : Javascript Phone Number Vailidation


lei
09-15-2005, 04:18 PM
i am wondering if anyone knows of a script that i won't have to edit (i'm not good at scripting) that can be used to validate a phone number in a form....we are running into issues with people not entering valid information in the phone number field....

thank you

_Aerospace_Eng_
09-15-2005, 04:31 PM
Is there a length that the number has to be? Basically what would be considered valid?

lei
09-15-2005, 05:46 PM
it should of course be numerical and contain an area code...10 digits at the very least

RysChwith
09-16-2005, 08:35 AM
Apple has a really good article on form validation, that has downloadable code to go with it:

http://developer.apple.com/internet/webcontent/validation.html

You know, much as I maintain my irrational dislike of the company, their developer site is really good.

Rys

Bill Posters
09-16-2005, 10:11 AM
The regexlib.com (http://www.regexlib.com/DisplayPatterns.aspx?cattabindex=6&categoryId=7) site may prove helpful as it offers a range of suggested regular expression (regex) patterns which can be used when validating a range of form data types including telephone numbers.

Additionally, I'd recommend displaying a correctly formatted, sample telephone number next to the telephone entry field(s).