开发者

Not showing confirmation dialog when data annatation errors

开发者 https://www.devze.com 2023-03-08 23:46 出处:网络
I\'ve simple MVC View for employee registration and when user click on \"Create Employee\" button, I’m displaying Jquery c开发者_开发问答onfirmation dialog.

I've simple MVC View for employee registration and when user click on "Create Employee" button, I’m displaying Jquery c开发者_开发问答onfirmation dialog.

How can I stop showing confirmation dialog when MVC View has Data Annotation errors.

Thanks, -Naren


Its basically the same as defined here

How to fire jQuery function only if form is valid

check if the form is valid:

$(function () { 
    $('#yourForm').submit(function () { 
        if($(this).valid()) { 
           //call dialog
        }
        else {
           //not valid
        }
    }); 
}); 

0

精彩评论

暂无评论...
验证码 换一张
取 消