[beta5] Single checkbox/radio error class/message

Created on 26 October 2023, almost 2 years ago
Updated 9 November 2023, over 1 year ago

Problem/Motivation

If a single checkbox/radio is required, when submitting the form, there is an error (visible in the global error message), but there is no inline error message on the related input, and no error style applied on it (should be red with a border on the left).

This problem only occurs on single checkbox/radio : when it's multiple options, there is an error message on the radio/checkbox group, and a global error style as well.

Proposed resolution

I've realized this is caused by the conditions on $variables['element']['#delta'] in ui_suite_dsfr_preprocess_form_element() : this variable doesn't exist, so "add_error" is always false.
My suggestion would be to use $variables['element']['#error_no_message'] instead, which seems to fit exactly that purpose (in the reverse way).

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France mh_nichts

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

Comments & Activities

Production build 0.71.5 2024