Skip to content

Autosave forms to local storage #34

@jeremydw

Description

@jeremydw

A project has requested an "autosave" feature for a form. We should implement a module that autosaves forms to local storage and restores them when the page is reloaded. There should be an API to clear the saved form data.

  • Thinking that the key names could be determined based on the field names.
  • By default, I would say that the form should autosave on keyup, debounced.

Some ideas around sample usage:

<form id="example">
  <input type="text" name="title">
  ...
</form>

var autosave = require('airkit/forms/autosave');

var el = document.getElementById('example');
var options = {...};  // Whatever options we might have.
var autosaver = autosave.init(el, options);
autosaver.clear();  // Clears saved data.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions