Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294483

Display meaninguful error messages according to the link type.

$
0
0

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

Skipping the internal path validation on LinkWidget::validateUriElement() for LINK_EXTERNAL url type.

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
- work on a patch.

User interface changes

No changes.

API changes

No changes.

Data model changes

No changes.


Viewing all articles
Browse latest Browse all 294483

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>