Skip to content

Autosave forms to local storage #34

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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