多个字段验证...一条错误消息 [英] multiple field validations...with one error message

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

问题描述

我需要验证3个文本字段,并在这些字段上显示红色边框高亮显示,但是在输入所有3个字段后要显示一条常见的错误消息.

I need to validate 3 textfields and show red border highlights on the fields but a common error message to show after all 3 fields have been entered.

我有3个文本字段:

<label>LABEL TEXT</label>
<input type="text" value="" size="2" maxlength="2" class="formInput" name="code1" />
<input type="text" value="" size="2" maxlength="2" class="formInput" name="code2" />
<input type="text" value="" size="2" maxlength="2" class="formInput" name="code3" />

字段验证:

是必填字段

只允许输入数字,而只能输入2个数字.

Only numbers are allowed and exact 2 numbers should be allowed.

客户端验证:

我需要对模糊应用验证,单击提交按钮将验证服务器端.

I need to apply validations on blur and on the click of a submit button it will validate server side.

我需要通过以下方式进行验证- 在第一和第二模糊时,我需要突出显示无效条目的字段.但是在模糊/输入所有三个字段中的数据后,显示一个常见的错误消息(标签将被错误消息替换).

I need to apply validations in the following manner---- On blur of the first and second, I need to highlight the fields for invalid entries. But show a common error message (label will be replaced with an error message) after blurring/entering the data in all the three fields.

如果上面的任何内容不清楚,请提出问题...非常感谢您的帮助.

Please ask questions if anything above is NOT clear...any help much appreciated.

推荐答案

建议使用jquery验证程序插件.阅读文档,您可以修改方法以执行自己喜欢的事情.这些论坛上有很多示例可以帮助您了解如何使用它.以及在线.

suggest using the jquery validator plugin. read the documentation, you can modify the methods to do what you like. there are plenty of examples on these forums to help you see how to use it. as well as online.

http://rocketsquared.com/wiki/Plugins/Validation#Validator

这篇关于多个字段验证...一条错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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