diff --git a/com.woltlab.wcf/templates/shared_form.tpl b/com.woltlab.wcf/templates/shared_form.tpl index cda2f88b36e..9ecac272d9a 100644 --- a/com.woltlab.wcf/templates/shared_form.tpl +++ b/com.woltlab.wcf/templates/shared_form.tpl @@ -82,3 +82,11 @@ FormBuilderFieldDependencyManager.checkDependencies(); }); + +{if !$form->isAjax()} + +{/if} diff --git a/ts/WoltLabSuite/Core/Form/Builder/FormGuard.ts b/ts/WoltLabSuite/Core/Form/Builder/FormGuard.ts new file mode 100644 index 00000000000..ba976680de3 --- /dev/null +++ b/ts/WoltLabSuite/Core/Form/Builder/FormGuard.ts @@ -0,0 +1,16 @@ +/** + * Prevents multiple submits of the same form by disabling the submit button. + * + * @author Marcel Werk + * @copyright 2001-2025 WoltLab GmbH + * @license GNU Lesser General Public License + * @since 6.2 + */ + +export function setup(form: HTMLFormElement) { + form.addEventListener("submit", () => { + form.querySelectorAll("input[type=submit]").forEach((button) => { + button.disabled = true; + }); + }); +} diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/FormGuard.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/FormGuard.js new file mode 100644 index 00000000000..74210655fdd --- /dev/null +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/FormGuard.js @@ -0,0 +1,20 @@ +/** + * Prevents multiple submits of the same form by disabling the submit button. + * + * @author Marcel Werk + * @copyright 2001-2025 WoltLab GmbH + * @license GNU Lesser General Public License + * @since 6.2 + */ +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.setup = setup; + function setup(form) { + form.addEventListener("submit", () => { + form.querySelectorAll("input[type=submit]").forEach((button) => { + button.disabled = true; + }); + }); + } +});