RouteInModalAjaxHelper::ajaxCallback, inline form errors and messages

Created on 13 January 2023, almost 2 years ago
Updated 4 April 2023, over 1 year ago

Problem/Motivation

In RouteInModalAjaxHelper::ajaxCallback, in case of form errors and when the inline_form_errors module is present, all messages are deleted:

if ($moduleHandler->moduleExists('inline_form_errors')) {
        // Refresh form with inline errors.
        $response->addCommand(new HtmlCommand('#route_in_modal_wrapper', $form));

        // Delete default messages.
        \Drupal::messenger()->deleteAll();
 }

This assumes that all present messages are corresponding the inline form errors. This however might not always be the case.
For example, a form with valid data that is submitted and something fails during submit. Such errors are now removed an never reach the end user.

Proposed resolution

Ideally, only the messages corresponding to inline form errors should be removed. If that is not possible, better show all messages then none (imo).

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇧🇪Belgium andreasderijcke Antwerpen / Gent

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