增加hex校验提示信息
This commit is contained in:
@@ -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);
|
||||
},"请输入字母数字或下划线");
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
@@ -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));
|
||||
|
||||
@@ -348,12 +348,12 @@ $(function(){
|
||||
$("#protocolId").val($(this).attr("protocolId"));
|
||||
});
|
||||
//选择hex cfgkeywords需校验十六进制
|
||||
/*$("select[name$='isHexbin']").each(function(){
|
||||
$("select[name$='isHexbin']").each(function(){
|
||||
$(this).on("change",function(){
|
||||
addHexCheck(this,$(this).val());
|
||||
});
|
||||
addHexCheck(this,$(this).val());
|
||||
});*/
|
||||
});
|
||||
// 校验搜索条件里的时间选框,不允许起始时间晚于终止时间
|
||||
$("#searchForm").validate({
|
||||
rules:{
|
||||
@@ -386,6 +386,15 @@ $(function(){
|
||||
},
|
||||
"doendDate": {
|
||||
compareDate: "[name=dobeginDate]"
|
||||
},
|
||||
"capIp":{
|
||||
ipv4v6:true
|
||||
},
|
||||
"sIp":{
|
||||
ipv4v6:true
|
||||
},
|
||||
"dIp":{
|
||||
ipv4v6:true
|
||||
}
|
||||
},
|
||||
submitHandler: function(form){
|
||||
@@ -395,6 +404,10 @@ $(function(){
|
||||
});
|
||||
});
|
||||
window.onload=function(){
|
||||
//日志查询IP类型增加格式提示
|
||||
$("#searchForm [name='capIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||||
$("#searchForm [name='sIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||||
$("#searchForm [name='dIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||||
// 动态调整日志页搜索框的样式,防止validate的错误提示导致样式错乱
|
||||
var igHeight = $("#searchForm").find(".col-md-12").find(".pull-left").find(".input-group").height();
|
||||
$("#searchForm").find(".col-md-12").find(".pull-left").find(".input-group").bind("DOMNodeInserted",function(e) {
|
||||
|
||||
Reference in New Issue
Block a user