diff --git a/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgForm.jsp index e3a9c4643..6e4a24442 100644 --- a/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgForm.jsp @@ -171,19 +171,6 @@ $(function(){ }, errorContainer: "#messageBox", }); - - $.validator.addMethod( - "checkIp", - function(value, element, params) { - var checkIp; - if ($("[name=ipType]").val() == 4) { - checkIp = /((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))/; - } else { - checkIp = /\S+/; - } - return this.optional(element) || (checkIp.test(value) && (RegExp.$1 < 256 && RegExp.$2 < 256 && RegExp.$3 < 256 && RegExp.$4 < 256)); - } - ); }); diff --git a/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp index 525838eba..0687d4814 100644 --- a/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp @@ -40,19 +40,6 @@ $(function(){ errorContainer: "#messageBox" }); - $.validator.addMethod( - "checkIp", - function(value, element, params) { - var checkIp; - if ($("[name$=ipType]").val() == 4) { - checkIp = /((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))/; - } else { - checkIp = /\S+/; - } - return this.optional(element) || (checkIp.test(value) && (RegExp.$1 < 256 && RegExp.$2 < 256 && RegExp.$3 < 256 && RegExp.$4 < 256)); - } - ); - $("#ipSelect").change(function(){ if($(this).prop("checked")){ $("[name^='ipCfg']").removeProp("disabled"); @@ -116,8 +103,6 @@ $(function(){ }); $(".ipType").on("change",function(){ - var mainTableType="${mainTableType}"; - var otherTables='${_cfg.otherTables}'; var tableName=$(this).attr("name").replace(".ipType",""); var type=$(this).val(); if(4==type){ diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js index 2cf794244..dcb762908 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js @@ -28,6 +28,19 @@ 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地址"); +jQuery.validator.addMethod( + "checkIp", + function(value, element, params) { + var checkIp; + if ($("[name$=ipType]").val() == 6) { + return this.optional(element) || (checkIp.test(value) && (RegExp.$1 < 256 && RegExp.$2 < 256 && RegExp.$3 < 256 && RegExp.$4 < 256)); + } else { + checkIp = /((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))/; + return this.optional(element) || /^((([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}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(value); + } + } +); + jQuery.validator.addMethod("abc",function(value, element) { return this.optional(element) || /^[a-zA-Z0-9_]*$/.test(value); },"请输入字母数字或下划线");