function fchkfrm() { console.log("form checked"); var sErr = ""; if (document.fContactUs.inf_field_FirstName.value=="") { sErr += "\n - Name"; } if (document.fContactUs.inf_field_Phone1.value=="") { sErr += "\n - Telephone number"; } var contactCheckbox = document.getElementById('privacy-policy-check'); if(!contactCheckbox.checked){ sErr += "\n - Please agree to our privacy policy before continuing"; } var emailcheck = fCheckEmail(document.fContactUs.inf_field_Email.value); if (document.fContactUs.inf_field_Email.value=="") { sErr += "\n - Email"; } else if (emailcheck == 'invalid') { sErr += "\n - Email is invalid"; } if (document.fContactUs.sMessage.value=="") { sErr += "\n - Enquiry"; } if (sErr!="") { alert("Please complete the following information:\n" + sErr); grecaptcha.reset(); } else { var invalid = 0; $("#pricing-form input").each(function(){ if($(this)[0].checkValidity()){ } else { invalid = 1; } }); if(!invalid){ grecaptcha.execute(); } // document.fContactUs.submit(); /* dhtmlmodal.open('boxCaptcha', 'div', 'divCaptcha', '', 'width=500px,height=400px,center=1,resize=0,scrolling=1'); document.fCaptcha.sForename.value=document.fContactUs.sForename.value; document.fCaptcha.sSenderEmail.value=document.fContactUs.sSenderEmail.value; document.fCaptcha.sTel.value=document.fContactUs.sTel.value; document.fCaptcha.sEmailMessage.value=document.fContactUs.sEmailMessage.value; if(document.fContactUs.bOptin.checked==true){ document.fCaptcha.bOptin.value='1'; }else{ document.fCaptcha.bOptin.value='0'; } */ } } function fSubmitForm() { $("#fContactUs").submit(); } var widget1; $('#submit-modal').click(function() { if (grecaptcha.getResponse(widget1) != '') { $('#fContactUs').submit(); } else { alert("Please tick I'm not a robot."); } });