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.
Due to the regression in #811542: Regression: Required radios throw illegal choice error when none selected, required radio buttons fail to validate properly. After that patch is applied, they should work in general, but the 'radios' Option Widget still does not work.
This is because the options widget is incorrectly setting #default_value to FALSE instead of NULL in some circumstances.
Comment | File | Size | Author |
---|---|---|---|
#6 | options-illegal-choice-default-1301596-6.patch | 1.39 KB | loganfsmyth |
#5 | options-illegal-choice-default-1301596-5.patch | 1.38 KB | loganfsmyth |
#1 | options-illegal-choice-default-1301596-1.patch | 720 bytes | loganfsmyth |
Comments
Comment #1
loganfsmyth CreditAttribution: loganfsmyth commentedThis changes it, so that when there is selected default value, the #default_value property is properly set to NULL, instead of the result of reset(), which was FALSE.
Again, this needs to be applied along with the patch in #811542: Regression: Required radios throw illegal choice error when none selected, at the moment in comment #70.
Comment #2
pillarsdotnet CreditAttribution: pillarsdotnet commentedLooks good, but marking as duplicate.
Added to #811542-72: Regression: Required radios throw illegal choice error when none selected
Comment #3
loganfsmyth CreditAttribution: loganfsmyth commentedThat makes sense :)
Comment #4
pillarsdotnet CreditAttribution: pillarsdotnet commentedUn-marking as dup, because this causes a test to fail and I don't want to hold up the other issue on that account.
Comment #5
loganfsmyth CreditAttribution: loganfsmyth commentedHere's a new patch that passes the tests, but I don't know if it really addresses the underlying issues.
The last test failed because, now that the 'radios' element has a null value, #value == '' of each underlying 'radio' element. This is hitting problems because it uses == to compare, so things with return_values of 0 will turn out 'checked'.
Comment #6
loganfsmyth CreditAttribution: loganfsmyth commentedThinking on it more, this might be a better solution.
#type 'radio' is more specifically boolean, so it makes more sense to specify default_value FALSE if it shouldn't be checked.
Comment #7
loganfsmyth CreditAttribution: loganfsmyth commentedRemoving 'needs review' because I have a new patch over at #811542: Regression: Required radios throw illegal choice error when none selected that includes the patch from comment 6.
Comment #8
pillarsdotnet CreditAttribution: pillarsdotnet commentedIn that case, this should be closed.
Comment #9
loganfsmyth CreditAttribution: loganfsmyth commentedI guess. I didn't want to fully close it until I'd heard some kind of response in the other issue...