EasyUI 1.3.1以下的组合验证

适用于EasyUI 1.3.1以下的, 1.3.2已经自带组合验证(如validType:['validator1','validator2'])

$.extend($.fn.validatebox.defaults.rules, {
//支持多重验证, 使用如data-options="validType:'multiple[\'float\',\'SmallerThan\']'":
multiple: {
validator: function (value, vtypes) {
var returnFlag = true;
var opts = $.fn.validatebox.defaults;
for (var i = 0; i < vtypes.length; i++) {
var methodinfo = /([a-zA-Z_]+)(.*)/.exec(vtypes[i]);
var rule = opts.rules[methodinfo[1]];
if (value && rule) {
var parame = eval(methodinfo[2]);
if (!rule["validator"](value, parame)) {
returnFlag = false;
this.message = rule.message;
break;
}
}
}
return returnFlag;
}
}
}
上一篇:Leecode刷题之旅-C语言/python-7.整数反转


下一篇:Jquery简单应用-1.8.3