8000 Add form persistence · Issue #11348 · whatwg/html · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add form persistence #11348
Open
Open
@FrameMuse

Description

@FrameMuse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0