Show validation errors outside details fields in G2 config

Created on 25 June 2023, about 1 year ago
Updated 28 June 2023, about 1 year ago

Problem/Motivation

In the G2 config screens, when a validation fails, the error is displayed on the component failing validation.

However, when these pages are displayed, the details fields are closed, so the error is not visible without opening the failing details field, which makes admins believe nothing happened, and does not let them understand their error.

Steps to reproduce

Open admin/config/content/g2/services on a freshly installed site. The WOTD will not be set. Attempt to submit e.g. a new alphabar value: nothing seems to happen.

Proposed resolution

Either display the error on top of the form, or force details in which an error exists to be open.

Remaining tasks

Do it.

User interface changes

Expose validation errors more visibly.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

User interface

Created by

πŸ‡«πŸ‡·France fgm Paris, France

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

Comments & Activities

  • Issue created by @fgm
  • πŸ‡«πŸ‡·France fgm Paris, France

    The problem is actually not with Drupal Form API errors, but with browser validation: the WOTD nid is marked as required, but when submitting the form with the empty WOTD (which is handled correctly by the WOTD logic), the browser blocks the form but does not open the wrapping details element.

    The solution is therefore to either force the details open when a browser error happens, which means some JS ; or to remove the "required" flag on the WOTD node, since we handle an empty nid correctly anyway. Hence choose the latter.

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update about 1 year ago
    51 pass
  • πŸ‡«πŸ‡·France fgm Paris, France

    Suggested patch. Also add some shortcut paths in the WOTD generation for the empty case.

    • fgm β†’ committed 7bc5edbf on 8.x-1.x
      Issue #3369920 by fgm: prevent unsubmittable controller setings form
      
  • Status changed to Fixed about 1 year ago
  • πŸ‡«πŸ‡·France fgm Paris, France

    Merged to current dev HEAD.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024