As the submission is handled by Ajax, just adding onsubmit=”return false” to the form element will not prevent the fields from clearing after submit.
You could of course delete this bit of code from the javascript of HTML Forms, but that will be overwritten again each update.
// clear form
if (!response.error) {
formEl.reset()
}
There is at this time no good way to prevent HTML Forms from clearing the form after it’s been successfully submitted.
Your awesome thank you, amazing response time. I have no problem maintaining this upon each update. Your forms plugin is great very lightweight and perfect addition for building applications.
Could you please direct me to the correct file location where I can find and remove this code. thank you so much.
Never mind I found it:
assets/src/js/public.js
-
This reply was modified 4 years, 3 months ago by
jrep305.
-
This reply was modified 4 years, 3 months ago by
jrep305.
Just saw that you wrote this:
“There is at this time no good way to prevent HTML Forms from clearing the form after it’s been successfully submitted.”
And Removing:
// clear form
if (!response.error) {
formEl.reset()
}
Had no effect…I really need the form data to stay intact after submission if you think of a way to handle this it would be great. I can have the page refresh after submission but that is not great for the UI.