A field widget that fails validation in settingsForm() does not display an error message without inline_form_errors

Created on 8 December 2023, about 1 year ago
Updated 17 February 2024, 10 months ago

Problem/Motivation

Error messages for widget settings forms do not display without having the inline_form_errors module enabled.

Steps to reproduce

  1. Go to the "Manage Display" tab of a content type
  2. Ensure the "Authored by" field is using the "Autocomplete" widget selected and edit its settings
  3. Empty out the required "Size of textfield" value and save
  4. Observe that no error message was visible but an error styling is set on the field.
  5. Go to any other page on the site and observe the error message is visible at the top of the page.

Screenshots with inline_form_errors enabled

Proposed resolution

This is a regression from Drupal 9 because the errors used to be visible when attempting to save the settings and now they are not unless you have the inline_form_errors module enabled.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Field 

Last updated about 19 hours ago

Created by

🇺🇸United States dave reid Nebraska USA

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

    It restores functionality that was present in earlier versions.

  • Contributed project blocker

    It denotes an issue that prevents porting of a contributed project to the stable version of Drupal due to missing APIs, regressions, and so on.

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.

  • Issue created by @dave reid
  • 🇺🇸United States dave reid Nebraska USA
  • 🇺🇸United States dave reid Nebraska USA

    Two contributed projects that I know of are also affected by this (Entity Browser and Focal Point) because they had specific #element_validate callbacks, but it also is affected by any field widgets that have a required field.

  • 🇮🇳India samit.310@gmail.com

    Hi @dave-reid,

    What would you suggest here? As we have inline_form_errors module added in Drupal core but not in enabled mode.
    I guess the inline_form_errors module sould be enabled by default, because it's not a good idea to add similar code again.

    Thanks
    Samit K.

  • 🇺🇸United States dave reid Nebraska USA

    Ideally I think it would work without inline_form_errors given it's not enabled by default or still considered optional even if it were enabled by default in the future. I'm sure it's a bug somewhere that just needs more investigation time in order to surface those errors.

Production build 0.71.5 2024