Skip to content

Autosave Form Module

Posted on:February 3, 2024 at 01:05 PM

Autosave Form Module: Technical Overview

The Autosave Form module is a valuable addition to Drupal, providing an autosave feature for all forms, including entity forms. This module is compatible with Drupal Core versions equal to or greater than 8.3.x.

Autosave Mechanism

The autosave functionality triggers a form submit every 60 seconds. This interval can potentially be modified through a solution that listens for DOM changes.

Configuration

The module includes a configuration form accessible under Admin->Configuration->Content->Autosave Form. Administrators can adjust the autosave interval and choose whether autosave is active for content entity forms, config entity forms, or both. By default, autosave is enabled only for content entity forms.

Future Extensions

While the current implementation supports entity and content forms, there are plans to extend the autosave functionality to cover to config forms too.

Conflict Management

Presently, there is no conflict management solution implemented. Autosaved states for an entity are purged upon entity save. Future releases aim to introduce conflict management, modifying this behavior.

In cases where a user is actively editing a form that is simultaneously saved by another user, an alert message notifies the first user that autosave has been disabled due to external saving.

User Interaction

Users encountering a form with an autosaved state receive a message offering options: resume editing, discard autosaved states, or, in future updates, view differences.

Compatibility with Nested Entity Reference Inline Forms

For users working with nested entity reference inline forms, entity deep serialization is necessary. Relevant Drupal Core issues include #2824097 and #2844229.

Storage Strategy

The Autosave Form module utilizes its storage strategy instead of revisions. Reasons for avoiding revisions include technical constraints, such as NOT NULL constraints in the database, and the efficiency of saving to a dedicated storage as opposed to entity tables. Autosave states are considered intermediate and specific to the current user, with the anticipation that users might disregard these states over time.

In conclusion, the Autosave Form module is a technical asset for preserving form data in Drupal. Future developments aim to enhance conflict management, extend functionality to regular forms, and maintain its role as a reliable tool for data preservation.

Auto save form