Submit buttons outside of actions do not work when inside steps

Created on 31 July 2023, over 1 year ago

Problem/Motivation

Submit buttons outside of actions (such as file field "Remove" buttons) do not work when inside steps because of the validate logic within the validateForm method in EntityFormSteps.php. One thing I noticed is that, because the form state is set to rebuild, the form no longer enters the core FormSubmitter to properly handle the pressed button (since it gets blocked on the following line within the core FormBuilder ProcessForm method: if (!$form_state->isRebuilding() && !FormState::hasAnyErrors()) {)

This issue also occurs with other buttons, such as multi entity reference "add more" buttons.

Proposed resolution

I fixed the issue for my site, by limiting the entity_form_steps validation to only occur on submits through buttons under "actions". A better solution might be to alter the way the validation works in general, if possible.

For now I will add a patch file for my solution in a following comment.

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium chewi3

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

Comments & Activities

Production build 0.71.5 2024