In the form, some fields are required, or when saving changes, you need to check whether the field is empty.
First, write the following in a new page (jsp) method, which MUserPassword and MUserCode field name
// 检查必填项
function CheckRequires(){
if ($("#MUserPassword").textbox("getValue").length==0){
top.messageShow("请设置成员巡检登录账号密码!","提示!");
return false;
}
if ($("#MUserCode").textbox("getValue").length==0){
top.messageShow("请设置成员巡检登录账号!","提示!");
return false;
}
return true;
}
// 获取表单数据
function getDialogValues(){
var retValue= $("objForm").serialize();
return retValue;
}
Then, this method requires the use of the method stored in the main interface
function CreateDialogParams(saveFunc){
var dialogParams={
toolbar:[{
text:'保存',
iconCls:'icon-save',
handler:function(){
//子页面验证方法
if (top.CheckRequires()){
//获取子页面数据
var retValue= top.getDialogValues();
saveFunc(retValue);
}
}
},{
text:'取消',
iconCls:'icon-cancel',
handler:function(){
top.closewindow();
}
}]
};
return dialogParams;
}