Page 1 of 1

email validation

Posted: Sun Mar 13, 2011 1:09 pm
by Alidad
Hi, I need help with registration forms. There are two text fields for (email and business website url address).

when person sign up and put website url address, and the email extension address should be match with the website extension address.

For sample that company website name www.amazon.com, and employee email should "xxxx@amazon.com".

How can i write the validation code to prevent continue process if website extension address are not same as email extension address!

pleae help thanks.

AM

Re: email validation

Posted: Mon Mar 14, 2011 4:25 pm
by mike_ebrahimi123
function validate(form_id,email) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.forms[form_id].elements[email].value;
if(reg.test(address) == false) {
alert('Invalid Email Address');
return false;
}
}