Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It doesn't seem possible to set "0" as the default value for checkboxes:
- Pull out a checkboxes field.
- Check customize keys. Set the first option to have a key of 0
- Try to select this first option as a default.
- The live preview will not check the first box, nor will the first option as the default save in the component configuration.
Comment | File | Size | Author |
---|---|---|---|
#1 | options_element_zero_default.patch | 1017 bytes | quicksketch |
Comments
Comment #1
quicksketchLooks like this bug is in Options Element rather than Form Builder.
Comment #2
quicksketchThe patch is pretty simple, looks like a classic case of checking for a value where "0" should be allowed, but is discarded because it evaluates to FALSE. Considering #1198142: Elements with #default_value of FALSE can't have their default value edited again (breaks Webform integration), we actually may want to allow FALSE as a default value, so this approach uses checking against NULL. Committed to both branches.