Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/appleple/form-storage
A JavaScript library stores the form-data to the localstorage so you don't have to fill the form again.
https://github.com/appleple/form-storage
es6 form-storage npm
Last synced: about 1 month ago
JSON representation
A JavaScript library stores the form-data to the localstorage so you don't have to fill the form again.
- Host: GitHub
- URL: https://github.com/appleple/form-storage
- Owner: appleple
- License: mit
- Created: 2017-12-27T02:58:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T20:51:12.000Z (about 2 years ago)
- Last Synced: 2024-04-26T15:02:08.023Z (8 months ago)
- Topics: es6, form-storage, npm
- Language: JavaScript
- Homepage: https://appleple.github.io/form-storage/
- Size: 610 KB
- Stars: 162
- Watchers: 10
- Forks: 12
- Open Issues: 23
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```sh
npm install form-storage --save
```### via yarn
```sh
yarn add form-storage
```### via cdn
```html
```
## Usage
When using Browserify or Webpack.
```js
import FormStorage from 'form-storage';
```When you don't want to remember some fields, then you can specify the selectors like below.
```js
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'
```js
const formStorage = new FormStorage('.js-form', {
name: 'form-basic',
includes: [
'[name="user-name"]',
'[name="user-email"]'
]
});
```