开发者

Not showing confirmation dialog when data annatation errors

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜