Framework7 Form Storage
Framework7 Form storage is used to store and parse forms data automatically on Ajax loaded pages. Every time the page gets loaded again the Framework7 will parse this data and automatically fill the form.
There are two types of form storage:
Enable form storage: If you want to enable form storage, you have to add store-data class and id attribute to form.
Form storage JavaScript API: Form storage can be achieved by using JavaScript API.
Enable Form Storage Example
Let’s take an example to display the form storage, which stores the data entered in the form and parse the form data automatically when the page is reloaded.
Form Storage JavaScript API Example
In Form Storage JavaScript API, all forms data are stored in local storage with keys. There are some methods to manage these local storage keys with form data.
Index | Class | Description |
---|---|---|
1) | myApp.formGetData(formId) | When you open an animation, this event will get fired. |
2) | myApp.formDeleteData(formId) | When the opening of an animation is completed, this event will get fired. |
3) | myApp.formStoreData(formId, formJSON) | When you close an animation, this event will get fired. |
Example
Let’s take an example to demonstrate the use of form storage JavaScript API which stores data in local storage in Framework7.