Display meaningful error messages according to the link type

Created on 17 November 2016, about 8 years ago
Updated 12 June 2024, 5 months ago

Problem/Motivation

Link fields set as External will get the error message "Manually entered paths should start with /, ? or #." if the user omits to input the scheme, i.e. using "www.example.org".

The error is misleading as the user is invited to start the path with "/,? or #". Doing this will let the form validation proceed on raising the appropriate error message which is "The path '@uri' is invalid." from LinkExternalProtocolsConstraint

LINK_EXTERNAL fields use HTML5 'url' type input so not all browsers let you submit the form with an invalid absolute URL. However browsers without support for 'url' type or forms with formnovalidate/novalidate attributes will still be affected.

Proposed resolution

However this is not possible until #2613694: Expose link_type on LinkWidget element is committed in order to get the link type from the validateUriElement() method.

Add different error messages meaningful to each link type.

Remaining tasks

- #2613694: Expose link_type on LinkWidget element
-

User interface changes

No changes.

API changes

No changes.

Data model changes

No changes.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Link 

Last updated about 9 hours ago

Created by

🇮🇹Italy gambry Milan

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024