重构代码:longbow.validate组件增加userName检查规则
#Comment 增加正则表达式检查用户名/^[a-zA-Z0-9_@.]*$/
This commit is contained in:
parent
70aa5bba6c
commit
5060a3e0aa
|
@ -275,6 +275,9 @@
|
||||||
$.validator.addMethod("radioGroup", function (value, element) {
|
$.validator.addMethod("radioGroup", function (value, element) {
|
||||||
return $(element).find(':checked').length === 1;
|
return $(element).find(':checked').length === 1;
|
||||||
}, "请选择一个选项");
|
}, "请选择一个选项");
|
||||||
|
$.validator.addMethod("userName", function (value, element) {
|
||||||
|
return this.optional(element) || /^[a-zA-Z0-9_@.]*$/.test(value);
|
||||||
|
}, "登录名称不可以包含非法字符");
|
||||||
}
|
}
|
||||||
$('[data-toggle="LgbValidate"]').lgbValidate();
|
$('[data-toggle="LgbValidate"]').lgbValidate();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue