HTTP和SSL配置主表单界面增加使用tags的关键字属性不能为空的校验逻辑

This commit is contained in:
zhangwei
2018-06-04 10:21:44 +08:00
parent 1c0896f46e
commit 2e19ab7ce6
3 changed files with 53 additions and 18 deletions

View File

@@ -41,14 +41,20 @@
$("#cfgFrom").validate( $("#cfgFrom").validate(
{ {
errorPlacement : function(error, element) { errorPlacement : function(error, element) {
$(element).parents(".form-group").find( if($(element).parents().hasClass("tagsinput")){
"div[for='" $(element).parents(".col-md-6").next("div").append(error);
+ element.attr("name") }else{
+ "']").append(error); $(element).parents(".form-group").find(
"div[for='"
+ element.attr("name")
+ "']").append(error);
}
}, },
submitHandler : function(form) { submitHandler : function(form) {
//loading('onloading...'); //loading('onloading...');
//代表所有业务都隐藏了,提示必须增加一种业务数据 //代表所有业务都隐藏了,提示必须增加一种业务数据
var flag = true;
//代表所有业务都隐藏了,提示必须增加一种业务数据
if($(".boxSolid").length ==$(".boxSolid.hidden").length){ if($(".boxSolid").length ==$(".boxSolid.hidden").length){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>"); top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return; return;
@@ -60,12 +66,25 @@
top.$.jBox.tip("<spring:message code='one_more_area'/>", "<spring:message code='info'/>"); top.$.jBox.tip("<spring:message code='one_more_area'/>", "<spring:message code='info'/>");
return; return;
} }
//将disable属性的元素删除 $(".boxSolid:visible").find("input[name$='cfgKeywords']").each(function(){
$(".disabled").each(function(){ if($(this).val()==''){
$(this).remove(); $(this).parents(".form-group").find(
}); "div[for='"
$("input[name$='exprType']").attr("disabled",false); + $(this).attr("name")
form.submit(); + "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
flag = false;
return;
}
})
if(flag){
//将disable属性的元素删除
$(".disabled").each(function(){
$(this).remove();
});
$("input[name$='exprType']").attr("disabled",false);
form.submit();
}
}, },
errorContainer : "#messageBox", errorContainer : "#messageBox",
}); });
@@ -97,6 +116,7 @@
</script> </script>
</head> </head>
<body> <body>
<span id="keywordError"><spring:message code="required"></spring:message></span>
<div class="page-content"> <div class="page-content">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@@ -151,7 +171,7 @@
<label class="control-label col-md-3"><spring:message <label class="control-label col-md-3"><spring:message
code="config_describe" /></label> code="config_describe" /></label>
<div class="col-md-6"> <div class="col-md-6">
<input class="form-control" type="text" name="cfgDesc" <input class="form-control" type="text" name="cfgDesc" multiple
value="${_cfg.cfgDesc}"> value="${_cfg.cfgDesc}">
</div> </div>
</div> </div>

View File

@@ -32,6 +32,7 @@
}, },
submitHandler : function(form) { submitHandler : function(form) {
//loading('onloading...'); //loading('onloading...');
var flag = true;
//代表所有业务都隐藏了,提示必须增加一种业务数据 //代表所有业务都隐藏了,提示必须增加一种业务数据
if($(".boxSolid").length ==$(".boxSolid.hidden").length){ if($(".boxSolid").length ==$(".boxSolid.hidden").length){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>"); top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
@@ -44,12 +45,25 @@
top.$.jBox.tip("<spring:message code='one_more_area'/>", "<spring:message code='info'/>"); top.$.jBox.tip("<spring:message code='one_more_area'/>", "<spring:message code='info'/>");
return; return;
} }
//将disable属性的元素删除 $(".boxSolid:visible").find("input[name$='cfgKeywords']").each(function(){
$(".disabled").each(function(){ if($(this).val()==''){
$(this).remove(); $(this).parents(".form-group").find(
}); "div[for='"
$("input[name$='exprType']").attr("disabled",false); + $(this).attr("name")
form.submit(); + "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
flag = false;
return;
}
})
if(flag){
//将disable属性的元素删除
$(".disabled").each(function(){
$(this).remove();
});
$("input[name$='exprType']").attr("disabled",false);
form.submit();
}
}, },
errorContainer : "#messageBox", errorContainer : "#messageBox",
}); });
@@ -82,6 +96,7 @@
</script> </script>
</head> </head>
<body> <body>
<span id="keywordError"><spring:message code="required"></spring:message></span>
<div class="page-content"> <div class="page-content">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">

View File

@@ -223,7 +223,7 @@
if (settings.interactive) { if (settings.interactive) {
markup = markup + '<input id="'+id+'_tag" value="" autocomplete="off" style="width:200px" data-default="'+settings.defaultText+'" />'; markup = markup + '<input id="'+id+'_tag" value="" autocomplete="off" style="width:200px"/>';
} }
markup = markup + '</div><div class="tags_clear"></div></div>'; markup = markup + '</div><div class="tags_clear"></div></div>';