开发者

Display both jQuery validation summary and individual error messages

开发者 https://www.devze.com 2022-12-24 12:55 出处:网络
I\'m using jQuery validation in ASP.net MVC. I would like to show validation summary and also individual error messages besides the control. I can do either one at a time. So it would be really helpfu

I'm using jQuery validation in ASP.net MVC. I would like to show validation summary and also individual error messages besides the control. I can do either one at a time. So it would be really helpful to know how can I dis开发者_如何学JAVAplay both.


I assume you are looking for JQuery only solution. I have no idea about the ASP .net MVC part.

You could use these hooks to accomplish most of it you want.

invalidHandler: function(e, validator) {
var errors = validator.numberOfInvalids();
// show the summary info here
},
errorPlacement: function(error, element) {
// element level error display manipulation
},
showErrors: function(errorMap, errorList) {
// Callback when the errors are actually shown
}

Check some of the examples in the jQuery validation plugin documentation.

0

精彩评论

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

关注公众号