(1)调整ip界面参数顺序

(2)修正验证方法同级触发时错误验证的bug
This commit is contained in:
wangxin
2018-05-25 16:35:20 +08:00
parent 3f52339f8f
commit 64da56e32d
2 changed files with 25 additions and 13 deletions

View File

@@ -170,7 +170,13 @@ jQuery.validator.addMethod("notStartZero",function(value, element) {
jQuery.validator.addMethod("ipCheck",function(value, element) {
if(value.length==0||value.trim().length==0){return true;}
var typeInt=$(element).parents(".row").siblings().find("select[name$='ipType']").val();
if(!typeInt){
typeInt=$(element).parents(".row").find("select[name$='ipType']").val();
}
var ipPattern=$(element).parents(".row").siblings().find("select[name$='ipPattern']").val();
if(!ipPattern){
ipPattern=$(element).parents(".row").find("select[name$='ipPattern']").val();
}
if(typeInt==4){
if(ipPattern){
if(ipPattern==1){//ip/掩码格式
@@ -231,6 +237,9 @@ jQuery.validator.addMethod("ipMask",function(value, element) {
if(value.length==0||value.trim().length==0){return true;}
obj=value;
var typeInt=$(element).parents(".row").siblings().find("select[name$='ipType']").val();
if(!typeInt){
typeInt=$(element).parents(".row").find("select[name$='ipType']").val();
}
if(typeInt==4){
if(obj=="255.255.255.255"){
return true;
@@ -249,6 +258,9 @@ jQuery.validator.addMethod("portCheck",function(value, element) {
if(value.length==0||value.trim().length==0){return true;}
obj=value;
var typeInt=$(element).parents(".row").siblings().find("select[name$='portPattern']").val();
if(!typeInt){
typeInt=$(element).parents(".row").find("select[name$='portPattern']").val();
}
if(typeInt==1){//port 0~65535
return this.optional(element)||(/^([0-9]+)$/.test(value) && (RegExp.$1 <=65535 && RegExp.$1 >=0));
}else if(typeInt==2){// port -mask 0~65535/0~65535