Problem/Motivation

In the Classic modeler, pressing Add node with an empty machine name outlines the field in red, but no error message is shown. The same happens for every other AJAX action of the form that fails validation.

The nodes-and-flows structure is the AJAX wrapper, and its id comes from Html::getUniqueId(), which gives it a new random suffix on each AJAX request. The response first replaces the old wrapper with the rebuilt one, then prepends the status messages to the old id. That id no longer exists, so the messages are dropped.

Even when the messages are kept, core puts them at the top of the structure, far above the control at the bottom of a long workflow.

Proposed resolution

  • Give the structure wrapper a stable id (Html::getId()).
  • When an AJAX action fails validation, show the messages just above the block holding the control that was pressed (the "Add a node" block, a node row or a flow row), and focus the first field in error.

Remaining tasks

  • Implement, with a test that the messages reach the rebuilt structure.

User interface changes

The error message of a failed AJAX action now shows next to the control that was pressed.

API changes

None.

Data model changes

None.

AI-Generated: Yes (Claude Code was used to help draft this issue summary. I reviewed it.)

Issue fork orchestra-3631389

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed 8db2c061 on 1.x
    fix: #3631389 Show the Classic modeler's validation errors after an AJAX...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.