Search code examples
javascriptjquerywordpressgravity-forms-plugin

jQuery .submit() not working on Gravity Forms (Wordpress Plugin)


Hello I have prepare jQuery validation for my Gravity Forms registration form to prevent submit but if my condition is match I want to submit my form but Javascript is not work as expected code is

jQuery("#gform_1").submit(function(e){
    if(jQuery("#input_1_1_3").val()=='' || jQuery("#input_1_1_6").val()=='' || jQuery("#input_1_2").val()=='' || jQuery("#input_1_4").val()=='' || jQuery("#input_1_5").val()=='' || jQuery("#input_1_3").val()=='' || jQuery("#input_1_3_2").val()==''){
      alert("All fields with * is mandatory");
        return false;
    }else{

      jQuery("#gform_1").submit();
      return true;
    }
});

The Only problem is with the submit function I don't know why it's not working, You can check form on my website


Solution

  • On your form submit button , you have this code on click

       onclick='if(window["gf_submitting_1"]){return false;}  window["gf_submitting_1"]=true;  '
    

    This codes makes your submit button works only once . Try removing it and it should work