- 🇺🇸United States dystopianblue
Confirmed, #8 works. Make sure to enable `inline_form_errors` which I had forgot to do, causing it not to work initially.
- 🇪🇸Spain pakmanlh Barcelona
I can confirm #8 works but sometimes the assumption of $complete_form['#type'] always existing can generate warning messages, for instance when you access `/admin/config/regional/language`when you have language module active.
I just added a check to mitigate this situation. Thanks! - 🇧🇷Brazil andre.bonon
Hi, thanks everyone for your contribution to this issue.
I tried to fix the issue using your approach for webforms (clientside_validation + webform_clientside_validation + inline_form_errors), but the issue was still happening.
In my case, my theme extends from stable9 that doesn't add classes like "form-checkboxes", "form-radios", or "form-type-[type]" to the form elements, which are used in the webform_clientside_validation js selectors.
Stable9 adds "js-form-type-[type]" and forgets about the "form-type-[type]" as in the snippet below:{% set classes = [ 'js-form-item', 'form-item', + 'form-type-' ~ type|clean_class, (THIS IS MISSING) 'js-form-type-' ~ type|clean_class, 'form-item-' ~ name|clean_class, 'js-form-item-' ~ name|clean_class, title_display not in ['after', 'before'] ? 'form-no-label', disabled == 'disabled' ? 'form-disabled', errors ? 'form-item--error', ] %}
I fixed the placement issue by overriding the form-element.html.twig and adding the code above. For the fieldset.html.twig, I added the following:
{% set classes = [ 'js-form-item', 'form-item', 'js-form-wrapper', 'form-wrapper', + 'form-' ~ element['#type'] (THIS IS MISSING) ]
- 🇧🇷Brazil andre.bonon
I reported this core bug https://www.drupal.org/project/drupal/issues/3380021 🐛 Stable9 form-element template misses form-type-* class Fixed , so it might avoid issues with themes based on stable9.
- 🇨🇦Canada igorbiki
Solution/patch #12 works for me. Both radios and checkboxes (as webforms elements) display error messages beneath all options.
- 🇮🇳India nikunjkotecha India, Gujarat, Rajkot
Thanks everyone, I would really appreciate if we can have some tests added to the patch.
I am trying to reproduce and confirm the fix and improve the solution (make it generic and work even without inline_form_errors module), I have got radios working but not able to make normal required validation work for checkboxes.