本文介绍了阻止jQuery验证消息,直到提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想在键入字段期间和之后隐藏所有错误消息(错误的输入或空白的字段).按下提交/按钮后,消息将全部显示/可见.

I just want to hide all the error message during and after typing the field (wrong input or empty field). And once the submit/button pressed then the message will all appear/visible.

问题是...每次我输入错误或将文本字段留空时,它总是显示错误消息,例如此字段是必需的",等等.

The problem is... every time I typed wrong or I leave the text field empty it always shows the error message such "this fields is required", etc.

rules : {

    "user.firstname" : {
    required : true,
    maxlength: 50,

},
messsages : {
required : "required",
maxlength: "the max-length is 50"
"
}

推荐答案

根据在线文档,则需要使用onfocusout:onkeyup:选项.

As per online documentation, you need to use the onfocusout: and onkeyup: options.

禁用 onblur验证:

This disables onblur validation:

onfocusout: false


禁用 onkeyup验证:

This disables onkeyup validation:

onkeyup: false


根据您是否具有复选框和单选按钮,您可能还希望禁用onclick:选项.


And depending on if you have checkboxes and radio buttons, you may want to disable the onclick: option as well.

禁用 onclick验证:

This disables onclick validation:

onclick: false

这篇关于阻止jQuery验证消息,直到提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:15