Save between each step

Created on 21 October 2020, over 4 years ago
Updated 26 February 2025, 3 months ago

Problem/Motivation

We have a very long multistep entity edit form and we would like to save data between each step to ensure data is not lost if the user does not complete every step.

Proposed resolution

We used a hook_form_alter to add this:

    $form['actions']['next']['#validate'][] = '::validateForm';
    $form['actions']['next']['#validate'][] = '::submitForm';
    $form['actions']['next']['#validate'][] = '::save';
    $form['actions']['back_button']['#validate'][] = '::validateForm';
    $form['actions']['back_button']['#validate'][] = '::submitForm';
    $form['actions']['back_button']['#validate'][] = '::save';

(I agree with #3066080 🐛 Validation handler of the next button breaks other form validation Fixed , it feels strange to have this in #validate and not in #submit.)

But it would be nice to have a supported option directly in the module.

Feature request
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇫🇷France prudloff Lille

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024