Reputation: 5143
I have an HTML form. I am filling it partially with data. I want to do a few things to protect the data that was filled and I don't know what is the best solution.
What is the best way to protect the data from the form?
I was thinking that if the user makes one of those three actions, a window should appear and inform him about the action that will take place.
Upvotes: 0
Views: 978
Reputation: 665486
What is the best way to protect the data from the form?
A more userfriendly way than showing warning messages would be just to autosave the data and not letting it get lost. On every input action, store the form values in the localStorage. When the form is loaded empty, restore them. When the form is submitted [successfully], clear them.
Upvotes: 2