Improve validatation UX for LinkWidget

Created on 19 January 2025, 4 months ago

Problem/Motivation

Working on 📌 Attempt to move large parts of LinkFieldTest to a kernel test Active I found, that on form widget submission with invalid urls, sometimes you receive not all error messages. That is poor user experience. It would be great to mark all invalid entries on signle form submission.

Steps to reproduce

1) Attach link field with multiple values to entity.
2) Start creating entity and using values for link field:

  • no-leading-slash
  • entity:non_existing_entity_type/yar
  • entity:user/invalid-parameter

3) On form submit you will receive error for first value ("no-leading-slash"):
Manually entered paths should start with one of the following characters: / ? #
4) Fix first value to "/no-leading-slash".
Submit form again, and you will receive 2 new error messages:

The path 'entity:non_existing_entity_type/yar' is invalid.
The path 'entity:user/invalid-parameter' is invalid.

Proposed resolution

Provide messages on step 3:

Manually entered paths should start with one of the following characters: / ? #
The path 'entity:non_existing_entity_type/yar' is invalid.
The path 'entity:user/invalid-parameter' is invalid.

Remaining tasks

  • Understand what is the reason of this behavior.
  • Decide if this should be fixed.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.1 🔥

Component

link.module

Created by

🇷🇺Russia zniki.ru

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

Comments & Activities

Production build 0.71.5 2024