Machine name field expands after failing validation

Created on 6 March 2019, over 5 years ago
Updated 6 April 2023, about 1 year ago

Problem/Motivation

I've always been wondering why failing validation on submit expands the machine name field, forcing the user to manually enter a machine name:

Sure, it's a bit stupid to hit "submit" omitting the label field, but it may happen. We still shouldn't punish the user, and should keep automatic machine name generation in place.

Steps to reproduce

Proposed resolution

Currently, the addition of the JS facilitated machine name generation is bypassed for any machine-name field that has an error.

Fix this by bypassing machine name generation IF it has an error AND the field is not empty. Empty fields will still get JS facilitated machine name generation as empty means there's nothing wrong with the field content, it simply doesn't exist yet.

This also requires removing the "required" attribute when the machine name field is hidden to ensure clientside validation does not attempt to focus it if it is empty - validation sufficiently does what is necessary with the visible field when empty.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Fixed

Version

10.1

Component
Javascript 

Last updated about 13 hours ago

Created by

Pancho UTC+2 🇪🇺 EU

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

  • Field UX

    Usability improvements related to the Field UI

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.69.0 2024