Disable client-side validation in MVC 3 “cancel” submit button

后端 未结 4 1770
梦谈多话
梦谈多话 2020-12-02 15:39

OK, been trying things for hours and could use some help. I\'m trying to implement a page in MVC 3 that has \"back\" and \"next\" buttons. When the back button is clicked I

4条回答
  •  星月不相逢
    2020-12-02 15:59

    I use this for button

    $("button").each(function (elem) {
        var button = $($("button")[elem]);
        button.addClass('cancel');
    
        if (button.attr('type') == 'submit') {
    
            button.click(function (e) {
                var validator = button.closest('form').validate();
                validator.cancelSubmit = true;
            });
        }
    });
    

提交回复
热议问题