jQuery .validate() submitHandler not firing

后端 未结 4 1553
野性不改
野性不改 2020-12-13 21:28

I\'m loading a dialog box with a form that\'s built on-the-fly using Bootbox.js and I\'m validating user input with a jQuery validate plugin.

Validation works just f

4条回答
  •  醉酒成梦
    2020-12-13 21:42

    Thanks Sparky for your help, the solution your provided gave me the answer. It seems having the submitHandler causes some confusion for the submit logic.

    I removed the submitHandler and added the following to success callback and everything works as expected

    success: {
             label: "Submit",
             className: "btn btn-sm btn-primary",
             callback: function () {
                 if($("#webteamContactForm").valid()){
                        var form = $("#webteamContactForm");
                        form.submit();
                    } else {
                        return false;
                    }
             }
        }
    

提交回复
热议问题