Skip to content

WebformInheritTask loses edits on all but the latest wizard page #336

Description

@jekuaitk

Summary

When a WebformInherit-task (os2forms_forloeb) inherits a submission into a multi-page wizard, edits made on any page other than the final one are silently discarded on submit.

Reproduce

  1. Create a Maestro flow with a WebformInherit-task that inherits an earlier submission.
  2. Use a multi-page (wizard) webform with editable fields on at least two pages.
  3. Open the inherit task — fields prefill correctly from the inherited submission.
  4. Edit a field on page 1 and a field on page 2.
  5. Submit.

Go the submission and observe that only edits on the final page persists. Data on any other page reverts to the inherited value.

Cause

MaestroWebformInheritTask::webformSubmissionFormAlter() runs on hook_webform_submission_form_alter, which fires on every form build. Any time it runs it sets each field's value to the inherited value. As a result, page transitions also override previous page data.

Webform core guards its own pre-population against exactly this in WebformSubmissionForm::buildForm().

Fix

Add equivalent guard to the WebformInherit-task.

Test

Same as reproduce but with different result:

  1. Create a Maestro flow with a WebformInherit-task that inherits an earlier submission.
  2. Use a multi-page (wizard) webform with editable fields on at least two pages.
  3. Open the inherit task — fields prefill correctly from the inherited submission.
  4. Edit a field on page 1 and a field on page 2.
  5. Submit.

Go the submission and observe that all edited data persists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions