Problem/Motivation
When the inline form errors module is enabled and a name field is completely empty, the resulting error messages are overly generic and messages are shown for hidden components. Here is what it looks like:

It would be great if just the required, visible components received error messages. It would also be great if those messages were contextual to the component in error.
Steps to reproduce
- Create a fresh D10 install.
- Composer require and enable the dev branch of the name module.
- Enable the inline form errors module.
- Create an entity with a name field or add a name form element to any form. Make sure at least one component is required.
- Submit the empty form.
In case it helps, here is a module that illustrates the scenario: https://www.drupal.org/files/issues/2023-11-10/inline_name_validation_te...
Proposed resolution
Update the name_element_validate function in name.module to provide a different validation strategy when inline form errors is enabled.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screenshot 2023-11-10 at 10.35.49 AM.png | 35.96 KB | lkacenja |
| inline_name_validation_test.zip | 2.17 KB | lkacenja | |
| Screenshot 2023-11-10 at 10.15.36 AM.png | 46.43 KB | lkacenja |
Issue fork name-3400886
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
lkacenjaI opened an MR that I believe fixes the problem. Here is what it looks like on that branch.
Comment #4
gregglesThanks for filing this issue and MR, @lkacenjar. Moving to Needs Review status since there's a proposed fix in an MR that needs feedback from the maintainers.
Comment #5
rymcveighThe current changes in this MR have been working for us for the last 11 months. These changes are ready IMO.
Comment #8
heddnThxs for the contributions.