<!--start card弹出层 -->
<div id="cardDiv" class="modal in" style="overflow: auto; display: none;" tabindex="-1"
aria-hidden="false">
<div class="modal-backdrop in" οnclick="closeCardDiv()"></div>
<form id="upgradeSave" action="upgradeSave.ct" method="post">
<input type="hidden" name="dictGradeId" id="dictGradeId">
<input type="hidden" name= "flag" id="flag">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body ui-front">
<table id="nameTable" class="table table-striped">
<tr>
<th>原班级名</th>
<th>升级班级名</th>
</tr>
<tr><td> </td><td><input type="submit" value="确认" class="btn btn-primary"></td></tr>
</table>
</div>
</div>
</div>
</form>
</div>
<!--end card弹出层 -->
//验证班级名称是否已经存在
$('#cardDiv').on('blur', '.dictClassName',
function() {
var $this = $(this);
var className = $this.val();
$.ajax({
type: "GET",
url: "isExistCName.ct",
data: {
className: className
},
dataType: "json",
success: function(isExist) {
if (isExist) {
$this.parent('td').next().text("已存在");
} else {
$this.parent('td').next().text("");
}
}
});
});
$('#cardDiv').on('submit', '#upgradeSave',
function() {
var flag = true;
$(".showExist").each(function() {
if ($(this).prev('td').find('input').val() == "") {
$(this).prev('td').find('input').focus();
flag = false;
return flag;
} else {
if ($(this).text() == '已存在') {
$(this).prev('td').find('input').focus();
flag = false;
return flag;
} else {
flag = true;
return flag;
}
}
});
return flag;
});