From c6fe047707cc777e45a6881b8125800b22ee8c57 Mon Sep 17 00:00:00 2001 From: Chiao F Date: Tue, 1 Jun 2021 17:44:04 +0800 Subject: [PATCH] Prevent double submission of quick create forms --- src/Grid/Tools/QuickCreate.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Grid/Tools/QuickCreate.php b/src/Grid/Tools/QuickCreate.php index 799b71c154..66788cc8d6 100644 --- a/src/Grid/Tools/QuickCreate.php +++ b/src/Grid/Tools/QuickCreate.php @@ -248,7 +248,7 @@ protected function script() }); $('.quick-create .create-form').submit(function (e) { - + $(':submit', e.target).button('loading'); e.preventDefault(); $.ajax({ @@ -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}); }