修改ip和port校验时ipType、ipPattern、portPattern
This commit is contained in:
@@ -169,13 +169,13 @@ jQuery.validator.addMethod("notStartZero",function(value, element) {
|
|||||||
//ip地址校验
|
//ip地址校验
|
||||||
jQuery.validator.addMethod("ipCheck",function(value, element) {
|
jQuery.validator.addMethod("ipCheck",function(value, element) {
|
||||||
if(value.length==0||value.trim().length==0){return true;}
|
if(value.length==0||value.trim().length==0){return true;}
|
||||||
var typeInt=$(element).parents(".row").siblings().find("select[name$='ipType']").val();
|
var typeInt=$(element).parents(".row").parent(".row").find("select[name$='ipType']").val();
|
||||||
if(!typeInt){
|
if(!typeInt){
|
||||||
typeInt=$(element).parents(".row").find("select[name$='ipType']").val();
|
typeInt=$(element).parents(".row").parent(".row").find("select[name$='ipType']").val();
|
||||||
}
|
}
|
||||||
var ipPattern=$(element).parents(".row").siblings().find("select[name$='ipPattern']").val();
|
var ipPattern=$(element).parents(".row").parent(".row").find("select[name$='ipPattern']").val();
|
||||||
if(!ipPattern){
|
if(!ipPattern){
|
||||||
ipPattern=$(element).parents(".row").find("select[name$='ipPattern']").val();
|
ipPattern=$(element).parents(".row").parent(".row").find("select[name$='ipPattern']").val();
|
||||||
}
|
}
|
||||||
if(typeInt==4){
|
if(typeInt==4){
|
||||||
if(ipPattern){
|
if(ipPattern){
|
||||||
@@ -291,9 +291,9 @@ jQuery.validator.addMethod("ipMask",function(value, element) {
|
|||||||
}, "请填写正确的IP地址掩码");
|
}, "请填写正确的IP地址掩码");
|
||||||
jQuery.validator.addMethod("portCheck",function(value, element) {
|
jQuery.validator.addMethod("portCheck",function(value, element) {
|
||||||
if(value.length==0||value.trim().length==0){return true;}
|
if(value.length==0||value.trim().length==0){return true;}
|
||||||
var typeInt=$(element).parents(".row").siblings().find("select[name$='portPattern']").val();
|
var typeInt=$(element).parents(".row").parent(".row").find("select[name$='portPattern']").val();
|
||||||
if(!typeInt){
|
if(!typeInt){
|
||||||
typeInt=$(element).parents(".row").find("select[name$='portPattern']").val();
|
typeInt=$(element).parents(".row").parent(".row").find("select[name$='portPattern']").val();
|
||||||
}
|
}
|
||||||
if(typeInt==1){//port 0~65535
|
if(typeInt==1){//port 0~65535
|
||||||
if(this.optional(element)||(/^(0|[1-9]+)$/.test(value))){
|
if(this.optional(element)||(/^(0|[1-9]+)$/.test(value))){
|
||||||
|
|||||||
Reference in New Issue
Block a user