策略号唯一性验证

This commit is contained in:
duandongmei
2018-06-22 17:08:29 +08:00
parent 1b456bec41
commit d17ab9f36a

View File

@@ -23,29 +23,44 @@ $(function(){
submitHandler: function(form){
var flag = true;
var cfgId=$("#cfgId").val();
if($("#isAdd").val() == true){
$.ajax({
type:'post',
async:false,
url:'${ctx}/maintenance/dnsResStrategy/validCfgId',
data:{"cfgId":cfgId},
success:function(data){
if(data){//存在cfgId
flag=false;
}else{
flag=true;
}
}
});
var message="";
if(cfgId <=100 && cfgId != 0){
message="策略号值只能为0或大于100";
flag=false;
}
if(flag){
if($("#isAdd").val() == 'true'){
$.ajax({
type:'post',
async:false,
url:'${ctx}/maintenance/dnsResStrategy/validCfgId',
data:{"cfgId":cfgId},
success:function(data){
if(data){
flag=false;
message="策略号已存在";
}
}
});
}
}
if(flag){
$("#cfgId").removeClass("error");
$("#cfgId").attr("aria-invalid","false");
}else{
$("div[for=cfgId]").html("<label for=\"cfgId\" class=\"error\" id=\"cfgId-error\">"+message+"</label>");
$("#cfgId").addClass("error");
$("#cfgId").attr("aria-invalid","true");
}
if(flag){
form.submit();
}
},
errorContainer: "#messageBox",
errorContainer: "#messageBox"
});
});
</script>
</head>
<body>
@@ -83,7 +98,7 @@ $(function(){
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="policy_number"/></label>
<div class="col-md-6">
<input class="form-control required" <c:if test="${!isAdd}" >readonly="true"</c:if> type="text" id="cfgId" name="cfgId" value="${_cfg.cfgId}">
<input class="form-control required number" <c:if test="${!isAdd}" >readonly="true"</c:if> type="text" id="cfgId" name="cfgId" value="${_cfg.cfgId}">
</div>
<div for="cfgId"></div>
</div>