• Resolved jrep305

    (@jrep305)


    Hello I would like to not clear the form content that was entered into the input fields on submit.

    Easy way to do this would be if I can add onsubmit=”return false” to <form onsubmit=”return false”> How would I do this with HF Forms?

    • This topic was modified 2 years, 9 months ago by jrep305.
    • This topic was modified 2 years, 9 months ago by jrep305.
Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    Thread Starter jrep305

    (@jrep305)

    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.

    Thread Starter jrep305

    (@jrep305)

    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 2 years, 9 months ago by jrep305.
    • This reply was modified 2 years, 9 months ago by jrep305.
    Thread Starter jrep305

    (@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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dont clear form on submit’ is closed to new replies.