Phone Number And Email Validation Update

by Hiroshi on June 15, 2008

in Form Validation

We use number validation i.e. in phone number field that restrict everything in field except 0 to 1. Some times user wants that phone number should be in in different format i.e. (+92)-(300)-(4269752) instead of +923004269752 and similarly in email address field it is recommended that you just check the presence of . and @.

This update is in procession with phone number validation and email validation in form validation.

For Phone Number

in allowed characters add – and () and + also because some users can use these also…

var checkOK = "0123456789-()+";

For Email Address

function isValidEmail(str)
return (str.indexOf(".") >= 0) && (str.indexOf("@") >= 0);

Updated Validation Script For Email and Phone Number Download

Related Posts

Previous post:

Next post: