Skip to content

Commit

Permalink
Prevent double submission of quick create forms
Browse files Browse the repository at this point in the history
  • Loading branch information
joy2fun authored Jun 1, 2021
1 parent e78ebbc commit c6fe047
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 c6fe047

Please sign in to comment.