Add form persistence
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 3.2k
- PR merge metrics
- PR metrics pending
Description
What problem are you trying to solve?
As you may know forms are very common UI widget and it's also common for user to have a stroke whenever it fills in inputs just to find out that it's all gone after accidental navigation or modal closure. It would be nice if browsers have a way to tell a form to restore data for its inputs and save sanity for many users.
What solutions exist today?
It could be done by JS, but with a browser implemented way it could be just a breeze for developers to introduce their persistence per form and it doesn't require creating "special" elements or scripts for each input to save data somewhere. It also can store more data than regular localStorage or sessionStorage as it'd be closed Browser API and it seems to be safe since AFAIK all input values are always strings.
How would you solve it?
I propose to add a property to form element to command it to restore its FormData to whatever it was.
Data could be either saved to local storage (for a domain) or session one (for a browser tab) by choosing between persist="local" and persist="session".
For it to work, a form must have either id or name and it will save/restore only those inputs, which also have it.
Each input could also define if it's restorable or not.
<form id="myform" name="myform" persist="local" persist="session">
<input name="1" />
<input name="2" />
<input name="3" />
</form>
Anything else?
Thanks for your feedback.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation file, entry point, or test is identified. Start by reviewing the HTML Standard’s existing treatment of form elements, FormData, localStorage, and sessionStorage, then clarify the persistence model and interoperability requirements in this proposal. Done means an agreed specification and corresponding tests, none of which are named here.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100