jeecg的新增、编辑表单时,如果使用beforesubmit函数,会存在遮罩层不消失现象。
<t:formvalid formid="formobj" dialog="true" usePlugin="password"
layout="table" beforeSubmit="validPassword()"
action="numberController.do?doUpdatePassword">
</t:formvalid>
当返回return false需求去掉遮罩层需要加上以下代码
//下面三行代码将form表单提交的数据加载中遮罩层取消
var infoTable = subDlgIndex.DOM.t.parent().parent().parent();
infoTable.parent().css('display','none');
infoTable.parent().parent().children("#ldg_lockmask").attr("hidden","true");
return false;
例:
function validPassword() {
var password=$("#password").val().toString();
var password2=$("#password2").val().toString();
if(password != password2){
alert("密码不一致!");
//下面三行代码将form表单提交的数据加载中遮罩层取消
var infoTable = subDlgIndex.DOM.t.parent().parent().parent();
infoTable.parent().css('display','none');
infoTable.parent().parent().children("#ldg_lockmask").attr("hidden","true");
return false;
}
var phoneReg = new RegExp(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/);
if(!phoneReg.test(password)){
alert("至少八个字符,至少一个字母和一个数字!!!");
//下面三行代码将form表单提交的数据加载中遮罩层取消
var infoTable = subDlgIndex.DOM.t.parent().parent().parent();
infoTable.parent().css('display','none');
infoTable.parent().parent().children("#ldg_lockmask").attr("hidden","true");
return false;
}
return true;
}