baigoValidatorjQuery表单验证插件
baigoValidator 是基于 jQuery 的表单验证插件。在线演示
文件结构:
-
baigoValidator.js 验证插件
-
baigoValidator.css CSS 样式
-
status_x.png 验证失败时的图标
-
status_y.png 验证成功时的图标
-
loading.gif 正在验证图标
-
readme.txt 使用说明
使用方法:
-
载入 jQuery 库文件,jQuery 库文件请到 http://www.jquery.com 下载,例:
<script src="jquery.js" type="text/javascript"></script>
载入 baigoValidator 样式表,例:
<link href="baigoValidator.css" type="text/css" rel="stylesheet" />
载入 baigoValidator 核心文件,例:
<script src="baigoValidator.js" type="text/javascript"></script>
-
初始化 baigoValidator,fileds_set 为配置参数,类型为 JSON,名称可以自定义,例:
<script type="text/javascript">$(document).ready(function(){ obj_form = $("#form_id").baigoValidator(fileds_set); });</script>
-
配置参数,具体请参考 配置参数说明,例:
<script type="text/javascript">var fileds_set = { name: { length: { min: 1, max: 100 }, validate: { type: "str", format: "text" }, msg: { id: "msg_prj_status", too_short: "太短", too_long: "太长" } }, no: { length: { min: 4, max: 4 }, validate: { type: "str", format: "int" }, msg: { id: "msg_prj_status", too_short: "太短", too_long: "太长" } }, email: { length: {min: 1, max: 0 }, validate: { type: "str", format: "email" }, msg: { id: "msg_prj_status", too_short: "太短" } }, digit: { length: { min: 1, max: 0 }, validate: { type: "digit", format: "int" }, msg: { id: "msg_prj_status", too_short: "太短" } }, checkbox: { length: { min: 1, max: 0 }, validate: { type: "checkbox" }, msg: { id: "msg_prj_status", too_few: "太少" } }, user_name: { length: { min: 1, max: 0 }, validate: { type: "ajax" }, msg: { id: "msg_prj_status", too_few: "太少" } ajax: { url: "http://www.nbfone.com/ajax/", key: "user_name", "type" : "str" } } }</script>
-
定义需要验证的字段 id 或 group,此处需与 配置参数 中的定义一致,例:
<input type="text" id="name" /><input type="checkbox" id="name" group="test" />
-
定义需要验证的表单项的 class,class 的值必须为 validate,例:
<input type="text" id="name" class="validate" /><input type="text" id="name" group="test" class="validate" />
-
触发验证,例:
<script type="text/javascript">var obj_form = $("#cate_form").baigoValidator(fileds_set);$("#cate_form").submit(function(){ obj_form.validateSubmit(); });</script>
评论
Jquery表单验证插件表单验证插件
目前支持对以下格式的值进行验证: cnum*-*(纯数字), char*-*(纯字母), zwen*-*(中文), bysc*-*(字母开头), mail(邮箱), yzbm(邮政编码) *
Jquery表单验证插件表单验证插件
0
ValidationjQuery表单验证插件
jquery.validate.js是一款执行表单输入信息验证的jQuery插件。要求jQuery1.2.6+,compatiblewith1.3.x特点:安装简单内置超过20种数据验证方法直列错误提
ValidationjQuery表单验证插件
0
EasyValidatorJQuery表单验证插件
最容易上手的表单验证框架,故名EasyValidator。网上有很多流行JQ验证插件,但是用起来总是很麻烦,还要写一大堆的JS配置信息,上手难度大。本插件易上手,易维护,扩展性高,无需用户写任何JS代
EasyValidatorJQuery表单验证插件
0
jQuery.validityjQuery表单验证插件
jQuery.validity是一个优雅的、功能强大的jQuery插件,用来实现表单的数据验证,无需服务器端支持。
jQuery.validityjQuery表单验证插件
0
jqValidatejQuery 表单验证插件
jqValidation是一个jQuery的表单验证插件,支持多语言、模板化、提供常用的验证规则例如URL、Email、日期数据,也可以使用正则表达式进行输入验证,使用该插件无需对HTML代码进行修改
jqValidatejQuery 表单验证插件
0