Disable form builder dialog submit button after submitting form
authorMatthias Schmidt <gravatronics@live.com>
Thu, 20 Jun 2019 15:16:09 +0000 (17:16 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 20 Jun 2019 15:16:09 +0000 (17:16 +0200)
See #2509

wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Dialog.js

index 96528008a948b85808734083e2cbbeb76e610d44..bff5c5b02cdc376863c70589497777cafdc5d143 100644 (file)
@@ -176,10 +176,14 @@ define(['Ajax', 'Core', './Manager', 'Ui/Dialog'], function(Ajax, Core, FormBuil
                 * @param       {object}        formData
                 */
                _submitForm: function(formData) {
+                       var submitButton = elBySel('button[data-type=submit]',  UiDialog.getDialog(this).content);
+                       
                        if (typeof this._options.onSubmit === 'function') {
-                               this._options.onSubmit(formData);
+                               this._options.onSubmit(formData, submitButton);
                        }
                        else if (typeof this._options.submitActionName === 'string') {
+                               submitButton.disabled = true;
+                               
                                Ajax.api(this, {
                                        actionName: this._options.submitActionName,
                                        parameters: {