infrangible / m2-form-storage
Remembers what visitors type into selected forms in their browser and fills it in again when they come back to the form.
Package info
github.com/infrangible-dev/m2-form-storage
Language:JavaScript
Type:magento2-module
pkg:composer/infrangible/m2-form-storage
Requires
- php: >=8.1
- infrangible/m2-foundation: ~3.0.2
- magento/framework: ~103.0.6
- magento/module-config: ~101.2.6
- magento/module-store: ~101.1.6
Requires (Dev)
- infrangible/phpstan-magento: ~1.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-29 13:23:06 UTC
README
Remembers what visitors type into selected storefront forms in their browser and fills it in again when they come back to the form.
Behavior
- The entries are saved in the browser's local storage while the visitor types or selects, and restored when the form is shown again, for example after an accidental reload or on a later visit. Nothing is sent to the server.
- Stored are text, email, number, date, time, phone, URL, search, color and range inputs, text areas, checkboxes,
radio buttons and dropdowns (also multiple selections). Checkboxes whose name ends with
[]are stored as a group of checked values. - Password fields are never stored. Values of password fields that version 1 stored are removed when the form is shown.
- Fields are identified by their
nameattribute; fields without a name are not stored. - Fields added to the form later by scripts are saved too and restored when they are added.
- The stored entries stay in the browser until the visitor clears the browser data. The module does not remove them after the form was submitted.
Configuration
Stores > Configuration > Infrangible Solutions > Form Storage > Settings > Forms (default, website and store view): one row per form.
| Column | Description |
|---|---|
| Selector | CSS selector of the form, for example #contact-form. Required. |
| Storage Name | Optional. Forms with the same storage name share their entries. By default the name or id of the form is used. |
| Layout Handle | Optional. The form is only watched on pages with this layout handle, for example contact_index_index. |
Forms without storage name, name and id are not stored; the browser console shows a warning for them.
Frontend
The module adds the script Infrangible_FormStorage/js/form-storage (alias formStorage) to the pages of Magento's
Luma-based themes. It can also be started for a form in a template without configuration:
<script type="text/x-magento-init"> {"#my-form": {"formStorage": {"storageName": "my-form"}}} </script>
All entries are stored as JSON under the local storage key formData, one object per storage name.
The Hyvä theme is not supported.
Requirements
- Magento Open Source or Adobe Commerce 2.4.6 or newer
- PHP 8.1 or newer
Installation
composer require infrangible/m2-form-storage bin/magento module:enable Infrangible_FormStorage bin/magento setup:upgrade
In production mode, also run bin/magento setup:di:compile and bin/magento setup:static-content:deploy.
License
Infrangible Form Storage is licensed under the MIT License - see the LICENSE file for details.