重构代码:longbow.validate组件增加userName检查规则

#Comment
增加正则表达式检查用户名/^[a-zA-Z0-9_@.]*$/
This commit is contained in:
Argo Zhang 2019-03-15 17:07:38 +08:00
parent 70aa5bba6c
commit 5060a3e0aa
1 changed files with 3 additions and 0 deletions

View File

@ -275,6 +275,9 @@
$.validator.addMethod("radioGroup", function (value, element) {
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();
});