Hi all,
I have form validation working well. The following is how i currently validate emails.
My question is how can i amend to validate it as an email?
if(""==document.forms.fa.user_email.value)
{
alert("Please enter an email address.");
return false;
}
I have found this following script but my javascript syntax is not up to scratch
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;
}
}