Problem/Motivation

In Drupal 11.4.11, attempting to add a new "Selection List" field of sub-type "Text" fails, only saving the first selection value entered. Repeated attempts to add more values eventually fails with the values getting added only as machine-readable text.

Steps to reproduce

  • Add a new field of type "Selection List" to an existing content type
  • For the sub-type select "Text" and select 'Continue'
  • Add three selection values
  • Save the changes

Now, go back and edit the field: what I'm always finding is that only the first selection value gets saved. If I try to re-add the remaining values and save, only the first and second ones get saved. Even weirder, if I try a third time to add the third value, I finally get all three saved, but on the third the human readable form always comes back in machine form (all lowercase with underscores instead of spaces).

Have tested this on three different sites of my own, one upgraded to Drupal 11, the other two originally created with Drupal 11. Had another person test on his site and he gets the same behavior. Have not had a chance to spin up a completely fresh Drupal 11 instance, but it seems unlikely that any third-party modules would be messing with something so deep in the core Drupal field system.

This would seem to be a major issue, as it's preventing anyone from adding a new Selection List field, and these are used for a lot of programmatic purposes (e.g. providing a fixed set of options for content that is to be filtered by those options in a view).

Proposed resolution

The process of adding a selection field should work as expected: you enter your selection values and they all get saved properly.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

iacwebdev created an issue.

iacwebdev’s picture

Follow-up: I just installed a fresh copy of Drupal 11.4.13 and verified that the bug exists in out-of-the-box Drupal. The behavior is almost random: with some selection values, the human-readable version gets replaced with the machine-readable version. In some cases, the first human-readable version gets successfully saved, but if you try to go back and change that text, the change is completely ignored (editing again shows the original text still in place). This is definitely not expected or usable behavior. Regardless of how the values are treated, any attempt to add more than one selection value at once completely fails, with only the first new value being saved (and even then having the human-readable text replaced with the machine readable text.)