jcadima
2/16/2016 - 3:43 PM

Validate Email

Validate Email


<form id="homeform" method="post" action="https://prestigepay.com/?page_id=208" onsubmit="return validateForm()">


</form>




function validateForm() {
    var fname  = document.forms["homeform"]["FirstName"].value;
	var lname  = document.forms["homeform"]["LastName"].value;
	var mobile = document.forms["homeform"]["MobilePhone"].value;
	var email  = document.forms["homeform"]["Email"].value;
// ...
    else if (email == null || email == "" || validateEmail(email) == false ) {

        sweetAlert("Oops!",  "Please enter a valid email address.", "error");
        return false;
    }	

	
}	


function validateEmail(email) {
    var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    return re.test(email);
}