Skip to content

Commit

Permalink
Merge pull request #5337 from joy2fun/fix-double-submission
Browse files Browse the repository at this point in the history
Prevent double submission of quick create forms
  • Loading branch information
jxlwqq authored Jun 4, 2021
2 parents e78ebbc + c6fe047 commit 0ba9c91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Grid/Tools/QuickCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ protected function script()
});
$('.quick-create .create-form').submit(function (e) {
$(':submit', e.target).button('loading');
e.preventDefault();
$.ajax({
Expand All @@ -268,7 +268,9 @@ protected function script()
$.admin.toastr.warning(data.message, '', {positionClass:"toast-top-center"})
}
},
error:function(XMLHttpRequest, textStatus){
error: function(XMLHttpRequest, textStatus){
$(':submit', e.target).button('reset');
if (typeof XMLHttpRequest.responseJSON === 'object') {
$.admin.toastr.error(XMLHttpRequest.responseJSON.message, '', {positionClass:"toast-top-center", timeOut: 10000});
}
Expand Down

0 comments on commit 0ba9c91

Please sign in to comment.