function validateForm() { //Validate Name field var x=document.forms["pm_subscription_form"]["contact_name"].value if (x==null || x=="") { alert("First name must be filled out"); return false; } //Validate Surname field var x=document.forms["pm_subscription_form"]["contact_lastname"].value if (x==null || x=="") { alert("Last name must be filled out"); return false; } //Validate Email field var x=document.forms["pm_subscription_form"]["contact_email"].value var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if (atpos<1 || dotpos=x.length) { alert("Not a valid e-mail address"); return false; } //Validate Phone number field var x=document.forms["pm_subscription_form"]["contact_mobile"].value if(isNaN(x)|| x.indexOf(" ")!=-1){ alert("Enter numeric value ex. 0111231234");return false; } if (x.length < 10 || x.length > 10 ){ alert("It should be 10 characters ex. 0111231234"); return false; } if (x.charAt(0)!="0"){ alert("It should start with 0 ex. 0111231234"); return false } //Validate Captcha field var x=document.forms["pm_subscription_form"]["captcha"].value if (x==null || x=="") { alert("Security field must be filled out"); return false; } //Validate Region field var x=document.forms["pm_subscription_form"]["contact_state"].value if (x==null || x=="") { alert("Region must be filled out"); return false; } //Validate Terms and Conditions field if (document.pm_subscription_form.terms.checked == false) { alert ('Please confirm that you\'ve read our terms and conditions.'); return false; } if (document.pm_subscription_form.op.checked == false) { alert ('Please confirm that you would like to subscribe to the Van Ryn\'s newsletter'); return false; } else { return true; } }