Andy-H Posted August 11, 2008 Share Posted August 11, 2008 Is there a JavaScript function (like the PHP !ctype_alnum()) to test if a string is alphanumeric. Also how do I test for a valid email address. Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/119084-solved-help-please/ Share on other sites More sharing options...
jithavijayan Posted August 11, 2008 Share Posted August 11, 2008 if(document.form.email.value!=null||document.form.email.value!="") { email1 = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/; if(!email1.test(document.form.email.value ) ) { alert("Please enter the correct email address"); document.form.email.value=""; document.form.email.focus(); return false; } } You can validate e-mail like this. Link to comment https://forums.phpfreaks.com/topic/119084-solved-help-please/#findComment-613247 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.