|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
opinionS needed on email validation...
Hello again...
I need some EXPERT opinions on email validation (client-side). I know if someone has javascript disabled they can bypass any sort of javscript validation so I am planning to do some real hardcore email checking server-side too. However, I was curious what GOOD developers do when checking email addresses. I was using the email check that the W3schools provides. http://www.w3schools.com/js/js_form_validation.asp (look at email validation section) If you don't feel like going to the email part at the page let me briefly describe what it checks for in email address: "must contain at least an @ sign and a dot (.). Also, the @ must not be the first character of the email address, and the last dot must at least be one character after the @ sign." This should be enough right (since I will be doing more thorough checking using PHP once submitted)? If you think I need a better client-side email validation can you please provide link or code that I can look at. Thanks!
|
|
#2
|
||||
|
||||
|
If you are doing server side as well, not sure your question is even relevant. But, to answer your question, look for a good regexp to test the email. I use this one:
Code:
/^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i
__________________
Bittersweet web development. |
|
#3
|
|||
|
|||
|
i try to implement best techniques as early as possible... and since i was reading that javascript validation should be done (even in the presence of PHP validation) for ease of use on the user so it doesn't direct away from page on every little form error... i figured i should put that into practice...
in the future i plan to implement ALWAYS BOTH JS AND PHP validation... i guess for ease of use on the site visitors (JS)... and for the REAL check (PHP)... thanks!!! |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|