Add a #disable_inline_form_errors_summary property to disable the Inline Form Errors summary

Created on 20 May 2017, about 7 years ago
Updated 26 August 2023, 10 months ago

Problem/Motivation

In certain cases we want to disable duplicate messages (on top - summary - and inline).
We currently have the #error_no_message property which allowed us to disable errors messages for individual elements.

There may be some field that does not display the inline error, so the message is only visible in the summary. As an example, the Captcha field.
We should then keep the messages in the summary - even when the new property to disable the summary is requested - for fields that contain errors but can't display them inline (Eg. invisible elements, missing elements, ...).

Proposed resolution

Add a form property which can be used to disable IFE summary$form['#disable_inline_form_errors_summary'] = TRUE.
Keep the message in the summary for fields which can't show inline-error (Eg. invisible elements, missing elements, ...).

Completed tasks

Remaining tasks

  • Review and commit.

User interface changes

  • Developers will be able to remove the Summary message when IFE is enable.
  • The summary should still be visible for an element which can't show inline-error (invisible element, missing element, ...).

API changes

The form element will have an optional #disable_inline_form_errors_summary boolean, that if TRUE, disables the duplicate messages from summary & inline-error elements. If one or more elements with errors can't show inline-error (Eg. invisible elements, missing elements, ...) , the summary will remain visible with those messages only.

Summary generated with AI on April 20, 2023

Note that this summary has not yet been validated by a human.

The issue is about adding a possibility to disable the Inline Form Errors summary. This is useful in cases where you want to show only the inline errors, but not the summary with links to them. For example, this could be useful for AJAX forms, where you don't want the big red box at the top of the page.

The proposed solution is to add a new property to the form element, called #disable_inline_form_errors_summary. This property can be set to TRUE to disable the summary.

The patch has been written and tested, and it is ready to be merged.

The next steps are to update the issue summary and to get the patch merged.

โœจ Feature request
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Inline form errorsย  โ†’

Last updated less than a minute ago

  • Maintained by
  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands @dmsmidt
Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia nikunjkotecha India, Gujarat, Rajkot

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

  • Needs accessibility review

    Used to alert the accessibility topic maintainer(s) that an issue significantly affects (or has the potential to affect) the accessibility of Drupal, and their signoff is needed (see the governance policy draft for more information). Useful links: Drupal's accessibility standards, the Drupal Core accessibility gate.

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.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ญ๐Ÿ‡บHungary szantog
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rainbreaw

    During the A11y office hours, we added an AI generated summary to the description. This still needs to be validated by a human, but we are hoping this might help us make it easier to address issues.

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil Diego_Mow

    Patch 92 worked in both 9.5 and 10.1.
    I'm moving it to RTBC.

    About AI generated summary, I reviewed it and looks pretty similar to initial summary.
    It looks fine for me.

  • last update about 1 year ago
    28,652 pass, 4 fail
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

    As far as the API goes here I would like to repeat my comment from #67

    We don't have many "disable" options in Drupal; instead should we name the flag #inline_form_errors_summary and default it to TRUE, and then allow FALSE to disable it?

    Having said that we also have #error_no_message three lines above, so should we be consistent with that somehow?

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    I agree with @longwave. We discussed how that would be implemented. I think we need to implement hook_element_info_alter and add #inline_form_errors_summary there with a default of TRUE. I think the implementation would be:

    function inline_form_errors_element_info_alter(&$info) {
      $info['form']['#inline_form_errors_summary'] = TRUE;
    }
    
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    Also I'm really confused about why and why you'd use the setting here #disable_inline_form_errors_summary vs #disable_inline_form_errors vs #error_no_message. There's way too many double negatives here and also with the current implementation #disable_inline_form_errors_summary has to be set on the form level - but the comments and issue summary here indicate that there are still situations when it will be shown even if this is set...

    We need to add docs of these three variables and where and how they can be used. And perhaps when we write better docs a good name for the new thing will be more obvious.

  • Status changed to Needs review about 1 year ago
  • last update about 1 year ago
    29,297 pass, 4 fail
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil Diego_Mow

    Patch #100 goes with followed suggestion: use key #inline_form_errors_summary

    Note: we also have #disable_inline_form_errors, so consistency about naming here is really broken.
    My honest suggestion is that we have this issue solved since this feature is really overtime and open a task to discuss only consistency of naming for those keys.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ
    +++ b/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php
    @@ -177,7 +177,7 @@ public function testErrorMessagesNotInline() {
    -    $this->testForm['#disable_inline_form_errors'] = TRUE;
    +    $this->testForm['#inline_form_errors_summary'] = FALSE;
    

    Not sure why this is changing - looks like we'd be losing coverage.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil Diego_Mow

    Good cache alexpott. This was mistakenly changed.

    Adding patch 103 without this change.

  • last update about 1 year ago
    29,297 pass, 4 fail
  • ๐Ÿ‡ฌ๐Ÿ‡ทGreece fotisp

    Path #103 disables summary errors on all forms.

    +      // Do not show links to elements when the errors summary is disabled.
    +      elseif ($is_visible_element && $has_id && $form['#inline_form_errors_summary']) {
    +        unset($errors[$name]);
    +      }
    

    && $form['#inline_form_errors_summary']
    should be
    && !$form['#inline_form_errors_summary']

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia _utsavsharma

    Tried to address the pointer in #105.
    Please review.

  • last update 10 months ago
    29,463 pass, 2 fail
  • Status changed to Needs review 10 months ago
  • last update 10 months ago
    29,470 pass
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vsujeetkumar Delhi

    Fixed the fail tests for 10.1.x, Please have a look.

  • Status changed to Needs work 10 months ago
  • The Needs Review Queue Bot โ†’ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • ๐Ÿ‡ช๐Ÿ‡ฌEgypt suzy.william

    suzy.william โ†’ made their first commit to this issueโ€™s fork.

Production build 0.69.0 2024