添加未连接到字段的自定义jquery验证方法 [英] Add a custom jquery validation method not connected to a field

查看:86
本文介绍了添加未连接到字段的自定义jquery验证方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常所有验证方法都连接到一个字段,单选按钮,下拉菜单等.在我的情况下,我想进行一个常规的自定义验证,该验证取决于表单中的许多字段.

Normally all validation methods is connected to a field, radiobuttons, dropdowns etc. In my case I would like to do a general custom validation that depends on many fields in my form.

我不希望像正常的必需"一样突出显示其中的一个字段,我只想在errorcontainer中显示一条消息.

I dont want one field of them to become highlighted like a normal "required", i would rather just show a message in the errorcontainer.

有没有简单的方法可以做到这一点?

Is there a simple way to do this I have overlooked?

更新: 我想使用jQuery.validator.addMethod(...)添加自定义验证,但不将其分配给单个输入,而是将整个表单用作我的自定义验证,这将产生一些非常特殊的魔术,取决于许多字段

Update: i want to add a custom validation with jQuery.validator.addMethod(...) but not assign it to a single input, but rather the whole form as my custom validate will do some very special magic that depends on many fields

推荐答案

如果我很了解您有一个表格,并且表格顶部的例如"是所有错误的摘要..

if I understand well you have a form and "for example" at the top of the form a summary of all error..

如果这样..不是那么难^^ 只需在目标div上输入一个ID,一切就可以顺利完成

if so.. not so hard ^^ just tell at the target div an id and all goes well

如果您不知道在哪里观看 http://jquery.bassistance.de/validate/demo/errorcontainer-demo. html

if you don't know where watch this http://jquery.bassistance.de/validate/demo/errorcontainer-demo.html

我想这很有用:)

这篇关于添加未连接到字段的自定义jquery验证方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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