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]]:驗證時調(diào)用自定義函數(shù) 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中執(zhí)行 $("#formID").validationEngine();
4.判斷是否驗證通過 jQuery('#formID').validationEngine('validate'),返回為bool值
posted on 2012-02-07 11:31 學(xué)+無止境 閱讀(...) 評論(...) 編輯 收藏轉(zhuǎn)載于:https://www.cnblogs.com/guaniu/archive/2012/02/07/2341040.html
總結(jié)
以上是生活随笔為你收集整理的Jquery ValidateEngine表单验证的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: iPhone应用程序编程指南(窗口和视图
- 下一篇: BeanUtils.copyProper