Add a custom jquery validation method not connected to a field

谁都会走 提交于 2019-12-24 08:39:16

问题


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.

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?

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


回答1:


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

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

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

I tought it was usuful :)



来源:https://stackoverflow.com/questions/3069871/add-a-custom-jquery-validation-method-not-connected-to-a-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!