增加hex校验提示信息

This commit is contained in:
duandongmei
2018-08-07 13:52:28 +08:00
parent 13cfb88fdd
commit 66f1d115d5
5 changed files with 33 additions and 7 deletions

View File

@@ -24,10 +24,18 @@
});
}(jQuery));
jQuery.validator.addMethod("hexCheck", function(value, element) {
return this.optional(element) || /^([0-9|a-f|A-F]*)$/.test(value);
}, $.validator.messages.hexCheck);
jQuery.validator.addMethod("ip", function(value, element) {
return this.optional(element) || (/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256));
}, "请输入合法的IP地址");
//IPv4 IPv6
jQuery.validator.addMethod("ipv4v6", function(value, element) {
return this.optional(element) || (/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256))||/^\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:)|((:[0-9A-Fa-f]{1,4}){1,2}))))(%.+)?\s*$/.test(value);
}, "请输入合法的IP地址如IPv4 0.0.0.0或IPv6 ::");
jQuery.validator.addMethod("abc",function(value, element) {
return this.optional(element) || /^[a-zA-Z0-9_]*$/.test(value);
},"请输入字母数字或下划线");

View File

@@ -59,6 +59,7 @@
domainCheck:"Please enter a valid domain.",
checkParent:"Configuration Type must match it's parent.",
specServiceCodeCheck:"Protocol No is repeat.",
compareDate:"The end time should not be earlier than the start time."
compareDate:"The end time should not be earlier than the start time.",
hexCheck:"Please enter the HEX format chatactar"
});
}(jQuery));

View File

@@ -45,10 +45,11 @@
isp: "isp",
close_info: "close",
client_ip: "client ip",
ipv4: "ipv4",
ipv6: "ipv6",
ipv4: "IPv4",
ipv6: "IPv6",
over6: "4over6",
over4: "6over4",
ipv4v6:"IPv4(0.0.0.0) or IPv6(::)",
all: "all",
ip_subnet: "Subnet",
ip_range: "ip Range",
@@ -57,6 +58,7 @@
domainCheck:"Please enter a valid domain.",
checkParent:"Configuration Type must match it's parent.",
specServiceCodeCheck:"Protocol No is repeat.",
compareDate:"The end time should not be earlier than the start time."
compareDate:"The end time should not be earlier than the start time.",
hexCheck:"Please enter the HEX format chatactar"
});
}(jQuery));

View File

@@ -52,6 +52,7 @@
ipv6: "ipv6",
over6: "4over6",
over4: "6over4",
ipv4v6:"请输入合法的IP地址如IPv4(0.0.0.0)或IPv6(::)",
all: "全部",
ip_subnet: "Subnet",
ip_subnet: "Subnet",
@@ -61,6 +62,7 @@
domainCheck:"请输入有效的域名",
checkParent:"配置类型必须与上级配置一致!",
specServiceCodeCheck:"协议号重复",
compareDate:"结束时间不能早于开始时间"
compareDate:"结束时间不能早于开始时间",
hexCheck:"请输入十六进制字符"
});
}(jQuery));