显示jQuery验证摘要和单个错误消息 [英] Display both jQuery validation summary and individual error messages

查看:79
本文介绍了显示jQuery验证摘要和单个错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.net MVC中使用jQuery验证.除了控件之外,我还想显示验证摘要以及单个错误消息.我一次只能做一个.因此,知道如何同时显示这两者将非常有帮助.

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 display both.

推荐答案

我假设您正在寻找仅JQuery的解决方案.我对ASP .NET MVC部分一无所知.

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
}

检查jQuery验证插件文档中的一些示例.

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

这篇关于显示jQuery验证摘要和单个错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆