Skip to content

Commit 731c5fb

Browse files
committed
修复规则定义与引用的相关问题
1 parent 81ba504 commit 731c5fb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

jquery-validator-1.3.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@
505505
},
506506
// 获取指定名称对应的校验规则
507507
getRule: function(name){
508-
return this.rules[name] || fn.rules[name];
508+
return this.rules && this.rules[name] || fn.rules[name];
509509
},
510510
// 执行单个校验
511511
validate: function(value, rule, event){
@@ -564,7 +564,7 @@
564564
for(var i in rule){
565565
var validator = me.validator[i];
566566
if( validator ){
567-
context.validator = i, context.expression = rules[i];
567+
context.validator = i, context.expression = rule[i];
568568
if( validator.call(me, value, rule[i], context) === false ){
569569
return me.afterHandler(false, context);
570570
}
@@ -869,6 +869,7 @@
869869
"cellphone": true,
870870
"email": true,
871871
"idcard": {
872+
pre: "upper,flush",
872873
format: "idcard/18:[18,]"
873874
},
874875
"image": "jpg|jpeg|gif|png|bmp"

0 commit comments

Comments
 (0)