PDA

View Full Version : How to do email vaildation in javascript?



Ruriko
May 22nd, 2009, 03:06
How do you create in javascript to do email vaildation? to check

must contain 1 @
must contain 1 letter before the @
must contain 1 letter after the @
must not contain spaces, slash, colon, comma or semicolon

if the any of the rules are wrong it will alert the user saying "Invalid Email"

Exa_Ankur
May 24th, 2009, 01:54
Google is your friend when it comes to finding small snippets of code :)
See http://www.white-hat-web-design.co.uk/articles/js-validation.php

JonnyH
May 24th, 2009, 05:08
I say don't use javascript since it can be bypassed, I'd say use a mixture of AJAX & PHP on the textfield and the submit button.