Skip to content

Commit 0ba9c91

Browse files
authored
Merge pull request z-song#5337 from joy2fun/fix-double-submission
Prevent double submission of quick create forms
2 parents e78ebbc + c6fe047 commit 0ba9c91

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Grid/Tools/QuickCreate.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ protected function script()
248248
});
249249
250250
$('.quick-create .create-form').submit(function (e) {
251-
251+
$(':submit', e.target).button('loading');
252252
e.preventDefault();
253253
254254
$.ajax({
@@ -268,7 +268,9 @@ protected function script()
268268
$.admin.toastr.warning(data.message, '', {positionClass:"toast-top-center"})
269269
}
270270
},
271-
error:function(XMLHttpRequest, textStatus){
271+
error: function(XMLHttpRequest, textStatus){
272+
$(':submit', e.target).button('reset');
273+
272274
if (typeof XMLHttpRequest.responseJSON === 'object') {
273275
$.admin.toastr.error(XMLHttpRequest.responseJSON.message, '', {positionClass:"toast-top-center", timeOut: 10000});
274276
}

0 commit comments

Comments
 (0)