18 June 2019

contact form 7 pop up error message after submit button page reload error resolved

<script type="text/java-script">
$jq=jQuery.noConflict();  
$jq(document).ready(function(){
  $jq('#et_pb_contact_form_0 .et_pb_contact_submit.et_pb_button').on('click',function(){
   var res=true;
        var name=jQuery('#et_pb_contact_form_0 #et_pb_contact_name_1');
        var email=jQuery('#et_pb_contact_form_0 #et_pb_contact_email_1');
        var phone=jQuery('#et_pb_contact_form_0 #et_pb_contact_contactnumber_1');
    
        var name_regex=/^[a-zA-Z ]{2,100}$/;
        var email_regex=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        var phone_regex=/^[9876]\d{9}/;
       
       
        if (!(name_regex.test(name.val()))) {
            res=false;
            alert('Name must be A-Z Characters only');
            name.focus();
            return res;
            //console.log('XXXX');
        }
        if (!(email_regex.test(email.val()))) {
            res=false;
            alert('Email ID not valid');
            email.focus();
            return res;
            //console.log('XXXX');
        }
        if (!(phone_regex.test(phone.val()))) {
            res=false;
            alert('Phone no must be numeric and 10 Digits only');
            phone.focus();
            return res;
            //console.log('XXXX');
        }
       
   if(res==true){
    send_enquiry_to_crm(name.val(),phone.val(),email.val());
   }
         //console.log(.val());
        return res;
        return false;
  });
</script>