From 11383ff5aa542dcd6ee81fa4b1cb62ac62beb50e Mon Sep 17 00:00:00 2001 From: Tony Air Date: Tue, 21 Nov 2023 17:15:28 +0200 Subject: [PATCH] IMPR: Disable AJAX form buttons on submission process --- package.json | 2 +- src/js/ajax/form.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index da1401c..4963079 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate-react", - "version": "5.1.5", + "version": "5.1.6", "description": "This UI Kit allows you to build Bootstrap 5 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.", "author": "Tony Air ", "license": "BSD-2-Clause", diff --git a/src/js/ajax/form.js b/src/js/ajax/form.js index e467227..0402bd3 100644 --- a/src/js/ajax/form.js +++ b/src/js/ajax/form.js @@ -12,6 +12,11 @@ const submitForm = (e) => { console.log(`${NAME}: submit`) const data = new FormData(form); const parent = form.parentElement; + const btns = form.querySelectorAll('input[type="submit"],button') + + btns.forEach(el => { + el.setAttribute('disabled', 'disabled') + }) data.append('ajax', '1') form.classList.add('loading')