Problem/Motivation
When inline_form_errors is enabled, there is a summary that is displayed at the top of the page in a status message, when the form has field errors.
It is supposed to contain anchor links to the relevant fields, for the user to click on and correct the error.

However, on the text_textarea and text_textfield widgets, the anchor link is broken. It links to #edit-foobar-0, which is an ID that doesn't exist on the page, instead of #edit-foobar-0-value, which is the actual form field element.
The root cause is that the errorElement function on those widgets doesn't point to the proper form value element.
Steps to reproduce
1. Ensure that inline_form_errors is enabled.
2. Create a text or text_long field to a node bundle.
3. Add a constraint to the field definition on the bundle.
4. Create and save a node with a value that triggers a constraint validation error on the field.
5. Note that the link in the error summary status message does not work.
Proposed resolution
Update the errorElement function to point to value.
| Comment | File | Size | Author |
|---|---|---|---|
| example.png | 10.02 KB | odensc |
Issue fork drupal-3635418
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
odenscComment #4
smustgrave commentedCan we move the inline_form_errors test to it's own file. Not sure that needs to be installed for all tests
Comment #5
smustgrave commentedAlso do any of these solve the problem #3557245: Use $element['#attributes]['id'] instead of $element['#id'] to create a link anchor #3589057: setErrorByName uses wrong path to link