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

View File

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

View File

@@ -223,7 +223,7 @@
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>';