Skip to content

A JavaScript library stores the form-data to the localstorage so you don't have to fill the form again.

License

Notifications You must be signed in to change notification settings

slavik925/form-storage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

form-storage

A JavaScript library stores the form-data to the localstorage so you don't have to fill the form again.

Installation

via npm

npm install form-storage --save

via yarn

yarn add form-storage

via cdn

<script src="https://unpkg.com/[email protected]/build/form-storage.js"></script>

Usage

When using Browserify or Webpack.

import FormStorage from 'form-storage';

When you don't want to remember some fields, then you can specify the selectors like below.

const formStorage = new FormStorage('.js-form', {
  name: 'form-basic', // you can decide local-storage name 
  ignores: [
  '[type="hidden"]',
  '[name="policy"]'
  ]
});
// apply storaged data to the form.
formStorage.apply();
// save the form data to the storage.
formStorage.save();

When you just want to remember 'user-name' and 'user-email'

const formStorage = new FormStorage('.js-form', {
  name: 'form-basic',
  includes: [
  '[name="user-name"]',
  '[name="user-email"]'
  ]
});

About

A JavaScript library stores the form-data to the localstorage so you don't have to fill the form again.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%