后台表单提交方式
This commit is contained in:
@@ -38,13 +38,13 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
return $msgbox;
|
||||
},
|
||||
valid: function (ret) {
|
||||
var that = this, submitBtn = $(".layer-footer [type=submit]", form);
|
||||
var that = this, submitBtn = $("button.btn[type=submit]", form);
|
||||
that.holdSubmit(true);
|
||||
submitBtn.addClass("disabled");
|
||||
submitBtn.addClass("disabled").attr('disabled', 'disabled');
|
||||
//验证通过提交表单
|
||||
var submitResult = Form.api.submit($(ret), function (data, ret) {
|
||||
that.holdSubmit(false);
|
||||
submitBtn.removeClass("disabled");
|
||||
// submitBtn.removeClass("disabled");
|
||||
if (false === $(this).triggerHandler("success.form", [data, ret])) {
|
||||
return false;
|
||||
}
|
||||
@@ -56,6 +56,11 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
//提示及关闭当前窗口
|
||||
var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
|
||||
sent.msg(msg, 'success');
|
||||
if (ret.url !== '') {
|
||||
setTimeout(function(){
|
||||
window.location.href = ret.url;
|
||||
}, 3000);
|
||||
}
|
||||
parent.$(".btn-refresh").trigger("click");
|
||||
return false;
|
||||
}, function (data, ret) {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
define(['jquery', 'layer', 'form', 'message'], function($, layer, form) {
|
||||
define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
var sent = {
|
||||
config: {
|
||||
keyName: 'sent_'
|
||||
},
|
||||
init: function(){
|
||||
form.api.bindevent($("form[role=form]"));
|
||||
if ($("form[role=form]").length > 0) {
|
||||
require(['form'], function(form){
|
||||
form.api.bindevent($("form[role=form]"));
|
||||
})
|
||||
}
|
||||
},
|
||||
msg: function(text, type){
|
||||
if (typeof type != 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user