Jquery ValidateEngine表单验证

用法:http://www.position-relative.net/creation/formValidator/demoValidators.html

1.页面中引入js jquery.js, jquery.validateEngine.js

2.在需要验证的表单上写class类   如 class=”validate[required]”,可用的验证属性:

validate[required]

validate[required,custom[url]]

validate[required,equals[password]]

validate[required,funcCall[checkHELLO]]:验证时调用自定义函数 checkHELLO

     function checkHELLO(field, rules, i, options){

      if (field.val() != "HELLO") {

      // this allows to use i18 for the error msgs

     return options.allrules.validate2fields.alertText;

      }

     }

validate[required,minSize[6]]

validate[required,maxSize[6]]

validate[required,custom[integer],min[-5]]

validate[required,custom[integer],max[50]]

validate[custom[date],past[2010/01/01]]

validate[custom[date],future[NOW]]

validate[custom[]]

 

date

An ISO date, YYYY-MM-DD

number

Floating points with an optional sign. ie. -143.22 or .77 but also +234,23

integer

Integers with an optional sign. ie. -635 +2201 738

ipv4

An IP address (v4) ie. 127.0.0.1

onlyNumberSp

Only numbers and spaces characters

onlyLetterSp

Only letters and space characters

onlyLetterNumber

3.验证 在document.onload中执行 $("#formID").validationEngine();

4.判断是否验证通过 jQuery('#formID').validationEngine('validate'),返回为bool值

posted on 2012-02-07 11:31 学+无止境 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/guaniu/archive/2012/02/07/2341040.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值