Drupal is a registered trademark of Dries Buytaert

The "Autosave Form" module provides an autosave feature for all forms (entity forms inclusive). Drupal Core >= 8.3.x is required.

Currently the autosave submit will be triggered every 60 seconds, but this approach might be exchanged later through a solution listening for DOM changes.

The autosave form module comes with a configuration form, which could be found under Admin->Configuration->Content->Autosave Form. There the interval could be easily adjusted and decide whether autosave is turned on for content or config entity forms or for both. By default it is active only on content entity forms and currently it is being tested only with content entity forms. If support for config entity forms is required please feel free to open an issue if you find some bugs regarding config entity forms.

At the moment the autosave works only for entity forms, but it will be extended to cover regular forms as well.

As there is no conflict management solution implemented yet, the autosaved states for an entity will be purged when the entity is saved - as soon as the conflict management solution is present this behavior will be changed. If a user is currently editing an entity form and it is already cached by e.g. ajax call for adding a new item to a multiple field, and it is being saved by another user, then an alert message will be shown indicating that the autosave has been turned off, because the entity has been saved elsewhere.

When the user opens a form, she was previously editing and an autosaved state is present she will see a message indicating that there is an autosaved state and will be offered the ability to resume the editing or discard the autosaved states. A third option "view differences" will be implemented later.

The module works out of the box for normal content entity forms, but if you have nested entity reference inline forms then you would require entity deep serialization. For that please take a look at the following Drupal Core issues
#2824097: Deep serialization for content entities to make an exact snapshot of an entity object's structure based on its current state
and
#2844229: [PP-1] Serializing content entity form objects should deeply serialize the entity in case of nested/inline entity forms.

Storage:
The autosave_form module does not use revisions for the autosave_states, but has its own storage. Some of the reasons for not using revisions are

  • There are technical limitations such as NOT NULL constraints in the database.
  • Saving to entity tables is slower than saving to a dedicated storage.
  • The autosave states aren't really revisions, but only intermediate states for the entity of the current user. Eventually the user might end up disregarding all of the autosave states.

Activity

Total releases
3
First release
Jan 2025
Latest release
1 year ago
Release cadence
10 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
8.x-1.10 Stable Feb 3, 2025
8.x-1.9 Stable Jan 17, 2025
8.x-1.8 Stable Jan 15, 2025