forked from p85126437/datagear
[web]表单提交后禁用提交按钮,完成后启用提交按钮
This commit is contained in:
parent
fe8ecd6fd9
commit
dc93575f29
|
@ -106,6 +106,8 @@ boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet"))
|
|||
var thisForm = this;
|
||||
var param = $.extend(formParam, {"data" : data, "originalData" : pageObj.originalData});
|
||||
|
||||
$(thisForm).modelform("disableOperation");
|
||||
|
||||
$.ajax(pageObj.url(pageObj.submitAction),
|
||||
{
|
||||
"data" : param,
|
||||
|
@ -139,6 +141,9 @@ boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet"))
|
|||
"complete" : function()
|
||||
{
|
||||
var $form = $(thisForm);
|
||||
|
||||
$form.modelform("enableOperation");
|
||||
|
||||
var batchSubmit = $form.modelform("isBatchSubmit");
|
||||
|
||||
if(batchSubmit)
|
||||
|
|
|
@ -115,23 +115,35 @@ boolean isPrivatePropertyModel = ModelUtils.isPrivatePropertyModelTail(propertyP
|
|||
{
|
||||
var thisForm = this;
|
||||
var param = { "data" : pageObj.data, "propertyPath" : pageObj.propertyPath, "propValue" : propValue };
|
||||
|
||||
$(thisForm).modelform("disableOperation");
|
||||
|
||||
$.post(pageObj.url(pageObj.submitAction), param, function(operationMessage)
|
||||
$.ajax(pageObj.url(pageObj.submitAction),
|
||||
{
|
||||
//如果有初始数据,则更新为已保存至后台的数据
|
||||
if(pageObj.data)
|
||||
$.model.propertyPathValue(pageObj.data, pageObj.propertyPath, operationMessage.data);
|
||||
|
||||
if(pageParam && pageParam.afterSave)
|
||||
close = (pageParam.afterSave(operationMessage.data) != false);
|
||||
|
||||
var pageObjParent = pageObj.parent();
|
||||
if(pageObjParent && pageObjParent.refresh)
|
||||
pageObjParent.refresh();
|
||||
|
||||
if(close && !$(thisForm).modelform("isDialogPinned"))
|
||||
pageObj.close();
|
||||
}, "json");
|
||||
"data" : param,
|
||||
"success" : function(operationMessage)
|
||||
{
|
||||
//如果有初始数据,则更新为已保存至后台的数据
|
||||
if(pageObj.data)
|
||||
$.model.propertyPathValue(pageObj.data, pageObj.propertyPath, operationMessage.data);
|
||||
|
||||
if(pageParam && pageParam.afterSave)
|
||||
close = (pageParam.afterSave(operationMessage.data) != false);
|
||||
|
||||
var pageObjParent = pageObj.parent();
|
||||
if(pageObjParent && pageObjParent.refresh)
|
||||
pageObjParent.refresh();
|
||||
|
||||
if(close && !$(thisForm).modelform("isDialogPinned"))
|
||||
pageObj.close();
|
||||
},
|
||||
"dataType" : "json",
|
||||
"complete" : function()
|
||||
{
|
||||
var $form = $(thisForm);
|
||||
$form.modelform("enableOperation");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -298,6 +298,24 @@
|
|||
return $.isDialogPinned(myDialog);
|
||||
},
|
||||
|
||||
/**
|
||||
* 禁止操作。
|
||||
*/
|
||||
disableOperation : function()
|
||||
{
|
||||
$(".form-foot input[type='submit']", this.element).button("disable");
|
||||
$(".form-foot input[type='reset']", this.element).button("disable");
|
||||
},
|
||||
|
||||
/**
|
||||
* 启用操作。
|
||||
*/
|
||||
enableOperation : function()
|
||||
{
|
||||
$(".form-foot input[type='submit']", this.element).button("enable");
|
||||
$(".form-foot input[type='reset']", this.element).button("enable");
|
||||
},
|
||||
|
||||
/**
|
||||
* 绘制。
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue