Problem/Motivation
This problem occurs with the inline_form_errorsmodule enabled and a Link field widget configured to accept external URLs. When a validation constraint error is produced by the Link field that error is shown inline in the field three times: once for the entire widget, once for the uri element, and once for the title element.
Steps to reproduce
- Enable the
inline_form_errorsmodule. - Add a link field to the Article content type. Set the "Allowed link type" to external links only. Set the "Allow link text" to optional.
- Attempt to create a new article. Enter 'test://example.com' for the URL field and 'Link' for the text fiield.
- Submit the form.
Expected Result
There should be a single inline form error for the entire Link field.
Actual Result
There are three inline form errors for the Link field.
Note: the issue is not reproducible with the example URL shown in the image below, /example.com. That will trigger the element's HTML5 validation error instead.
Proposed resolution
Set the violation error's path to the uri element in the validation constraint classes.
Remaining tasks
Update the tests for the inline form errors. Review. Feedback. Commit.
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #39 | Screenshot 2025-10-17 at 12.19.44 PM.png | 20.78 KB | smustgrave |
| #39 | Screenshot 2025-10-17 at 12.17.18 PM.png | 21.27 KB | smustgrave |
| #15 | Screenshot 2022-10-29 at 10.34.51 AM.png | 251.3 KB | gaurav_manerkar |
| invalid message.PNG | 13.67 KB | abh.ai |
Issue fork drupal-3077149
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:
- 3077149-duplicate-link-errors
changes, plain diff MR !13013
Comments
Comment #2
jidrone commentedThe problem was the Contraint Validator wasn't using the atPath method, and the widget didn't get the error element for subfields.
Comment #7
larowlanThis issue was today's Bugsmash triage target
The patch looks good, we just need some automated testing for this to ensure it stays fixed.
Comment #8
larowlanWrong tag
Comment #9
quietone commentedI tested this on Drupal 9.3.x, standard install and was not able to reproduce the problem.
I also tried on 8.9.19-dev with the same results.
Comment #10
larowlan@jidrone @abhaisasidharan - are you able to confirm this is no longer an issue
Comment #14
kristen polAs part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)". This issue was marked "Postponed (maintainer needs more info)" a year ago.
Like @quietone in #9, I also was unable to reproduce the issue. I tested with the same steps as in #9 other than I used the page content type.
Since neither I nor @quietone could reproduce this issue and since there weren't other steps to reproduce the issue provided since the issue was postponed a year ago, I'm marking the issue "Closed (cannot reproduce)". If anyone can provide complete steps to reproduce the issue (starting from "Install Drupal core"), document those steps in the issue summary and set the issue status back to "Active" [or "Needs Work" if it has a patch, etc.].
Thanks!
Comment #15
gaurav_manerkar commentedI am able to reproduce the issue on Drupal 9.4.x.
Steps to reproduce the issue:
Comment #16
gaurav_manerkar commentedComment #17
gaurav_manerkar commentedComment #18
gaurav_manerkar commentedComment #19
gaurav_manerkar commentedComment #20
gaurav_manerkar commentedUpdated Unit tests.
Comment #22
gaurav_manerkar commentedFixed unit tests.
Comment #23
gaurav_manerkar commentedComment #24
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.
Moving to PNMI for an updated issue summary specifically steps to reproduce.
Tried testing in 10.1.x and am not seeing the error.
Comment #25
smustgrave commentedComment #27
smustgrave commentedIf still a valid bug please reopen updating issue summary per #24
Thanks!
Comment #28
amateescu commentedWhat the issue summary didn't mention is that this is only reproducible with the
Inline form errorsmodule enabled. Updated the IS.Comment #29
smustgrave commentedThanks for updating!
If that's the case then the tests will need to be updated to check for that.
Comment #30
dcam commentedAdded the issue summary template. Added the Needs Tests tag because the existing tests need to be updated to check for those specifically.
Comment #32
dcam commentedThe patch from #22 was converted to an MR. The changes to
LinkNotExistingInternalConstraintValidatorTestdid not seem to be relevant anymore. No other test changes have been made.Comment #33
dcam commentedThe original proposed changes must be updated because the
arrayPropertyPathproperty was deprecated and removed. Here's the change record: https://www.drupal.org/node/3307919.Comment #34
dcam commentedWe need to repair a test in
LinkNotExistingInternalConstraintValidatorTestto test this properly. This issue is postponed on #3542967: Bad test in LinkNotExistingInternalConstraintValidatorTest.Comment #35
dcam commentedThe test fix was committed. This is unblocked now.
Comment #36
dcam commentedI modified the constraint validator Unit tests to ensure the error path is set to the
urielement. I also added an entire test for theLinkTypeConstraintValidatorwhich I then partially added to the pending bug fix in #3387013: Check LinkItemInterface::isEmpty() before validating. So when one of these two issues gets committed the other will need to be rebased and have the changes merged in.Comment #37
smustgrave commentedSince #3387013: Check LinkItemInterface::isEmpty() before validating is RTBC lets postpone this till that lands so it doesn't interrupt that one getting in.
Comment #38
dcam commentedI'm prioritizing this over #3387013: Check LinkItemInterface::isEmpty() before validating because that one's no longer RTBC. This MR has the more complete
LinkTypeConstraintValidatorTest. And IMO it's the more serious bug.Comment #39
smustgrave commentedBefore
After
Tested manually following the steps in the summary and I was able to reproduce.
After applying the MR the fix appears to be working
MR LGTM
Comment #42
catchOK this is more change than I expected from the issue title, but it's really the same change multiple times + supporting code + very good test coverage.
Committed/pushed to 11.x, thanks!