• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validating phone number and email in form

 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form with phone number and email fields that need some validation scripting. I need to make sure the user enters the phone number and email correctly, i.e. 10 digit phone number, no alphas, and check for '@' and '.' in the email entry. Any ideas would be greatly appreciated. Thanks in advance.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The great thing about JavaScript is people already did stuff for you if you know how to find it. Google is a big help:

Email Validation: http://www.google.com/search?q=JavaScript+email+validation
Phone validation: http://www.google.com/search?q=JavaScript+phone+number+validation

just remember that you need to validate on the server and also foreign phone numbers are not 10 numbers long. [if you care about international stuff]

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic