- Issue created by @tawellman
- ๐บ๐ธUnited States cilefen
I think this may be previously reported but I havenโt searched in detail.
- ๐บ๐ธUnited States tawellman
I have search a bunch. Any suggestion on what to be looking for? Am I using the wrong terminology?
- ๐บ๐ธUnited States cilefen
I definitely remember issues concerning 0 values in past. They could be different than this one.
I got the same problem. My site actual is a new site set up at core version 10.1.x. At that time the problem wasn't there. It first accrued after updating to 10.2.x. The problem might be related somehow to https://www.drupal.org/project/drupal/issues/3411419 ๐ Regression from #2521800: using machine name element for ListStringItem breaks with existing data Fixed ?
- ๐บ๐ธUnited States Dan_Rogers Driggs, ID
RE https://www.drupal.org/project/drupal/issues/3411419 ๐ Regression from #2521800: using machine name element for ListStringItem breaks with existing data Fixed , this has been committed and seems to be present in release 10.2.3, which I just updated to, but this issue still persists for me.
- First commit to issue fork.
- Merge request !6838valueCallback() returns #default_value instead of NULL โ (Open) created by shoroshanska
- ๐น๐ญThailand AlfTheCat
I tried the patch from MR in #10 on Drupal 10.2.3, but no luck in my case.
I have a list field with the first option having machine name "0" which I can't update anymore due to this issue.
- ๐ฎ๐นItaly Giuseppe87
Likewise #8 the issue seems to still exists:
I have a Drupal site with text list fields which have a machine names 0, 1, ...
On Drupal 10.1.8 they are valid and editable, with 10.2.3 I get ""Value field is required.".
- ๐ฎ๐ชIreland frankdesign
I'm seeing this issue as well. It only started with Drupal 10.2. Previous versions do not experience this error. It's happening on sites that were upgraded to Drupal 10.2 as well as new installs of Drupal 10.2.
I'm also experiencing the error if you reuse the list field on another entity type e.g. if you have the field on one paragraph type and then try to reuse the field on another paragraph type. It is worth noting that the field is added to the second paragraph type even though the error is displayed. But you cannot add additional values to the list.
Note: I have seen this error for both List (text) fields with the machine name of the text string '0' as well as List (integer) fields with the machine name of the number 0.
- ๐บ๐ธUnited States potassiumchloride
I have the same issue. I have a list field and the first option has a machine name "0" and I can't update the field at all. I need to add a default value for the field but because I can't save it without "Value field is required" I can't update the default. This bug renders the field un-editable.
- ๐บ๐ธUnited States courtneyjordan Albany, NY
I'm encountering this issue as well on 10.2.6
The value field remains disabled, displaying a 0 value.The list field i'm working on requires new field options and i'm currently unable to do that and not sure what to do.
- ๐ฎ๐ณIndia Prashant.c Dharamshala
I am not able to replicate this on
11.x
. - ๐บ๐ธUnited States courtneyjordan Albany, NY
I have an update with a work around. You can ethier remove the field and recreate it adding the new items to your list and keeping the machine names with their boolean values, keep in mind you'd need to do this for every instance you'd need to add a new item. If you have a time constraint and you need to make a quick change without mucking up the code this works.
-however-
It's best to recreate the list using a meaningful string of text for the machine name indicating the items action. The you'd never have to worry about the boolean value of 0 impacting future updates to your list.
These solutions will work but keep in mind if you plan to use boolean values refrain from using 0 as it equals null and that can cause breakage in this case. Hope this helps!
- ๐ณ๐ฟNew Zealand John Pitcairn
While using a value of "0" in a list (text) field is perhaps ill-advised, it should be possible, and it should definitely be possible to use a value of 0 in a list (integer) field. But that produces the same error.
I guess something is testing whether there's a value using
empty()
when really it should be callingisset()
or a strict equals.Re-titling to reflect the more general problem. Fortunately I found this before pushing the new field to production.