Closed svondervoort closed 1 month ago
Hi @svondervoort,
Yes, we are handling the disabled
state via our front-end plugin javascript. This is necessary for us to be able to provide various integrations and flows which require disabling the form for their duration.
If you would wish to manually manage disabled state, then you could tap into the freeform instance via javascript and manage your disabled state yourself.
Freeform has a namespaced disabled state, meaning that anything can lock the input via a key
and unlock it via the same key
, and if there are any active locks, the input will still stay disabled, to prevent from accidental unlocks during existing processes.
Here's an example of a simple script which locks the form
(function() {
const form = document.getElementById("my-form");
form.addEventListener("freeform-ready", () => {
// Lock the form
form.freeform.disableSubmit("my-custom-lock");
setTimeout(() => {
// Unlock the form after 5 seconds
form.freeform.enableSubmit("my-custom-lock");
}, 5000);
});
})();
Hi @gustavs-gutmanis thanks for sharing. Is this documented somewhere? maybe I just searched for the wrong term in the docs 😅
This was only used internally, so there's no documentation about it, but since you've shown interest, we will probably write documentation for this.
What happened?
Whenever I set the attribute
disabled
on the submit button through the form configuration it gets removed after a few miliseconds when loading the form in the frontend.Everything in
Settings -> Processing
is disabled, so I don't think its ajax.I can't find anything related in our javascript logic, so is FreeForm doing something with the disabled attribute by any chance?
Errors and Stack Trace (if available)
No response
How can we reproduce this?
disabled
attribute to thesubmit
button.Freeform Edition
Pro
Freeform Version
5.6.4
Craft Version
4.12.5
When did this issue start?
Unsure
Previous Freeform Version
No response