策略号唯一性验证
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user