I just committed a clean up for the optionwidgets tests - finding how to unselect items in selects / multiple select / radios / checkboxes / single checkbox with simpletest browser is, er, a journey...
This outlined the current behaviour : an unselected 'on / off checkbox' is currently stored as 0 (for number fields) or '0' for (text fields).
I don't think that's what we want, but I'm not sure of what we do want :
- store as empty (NULL) ?
- store as 'off value' (the 1st of the allowed values) ?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | fix_onoff_checkbox_zero_value.patch | 1.3 KB | wrunt |
Comments
Comment #1
yched commentedMeanwhile, this remains as a failed test.
(other than that, tests are 100% green)
Comment #2
yched commentedWhen setting a Views filter on such a field, the admin will be presented with 2 checkboxes,
field_foo is :
x [off_value]
x [on_value]
if we want the 1st checkbox to be of some use, then we need to store off_value for a non-selected checkbox.
Thoughts ?
Comment #3
yched commentedI'd also say we should fix this before we release, thus bumping to 'critical', but this can probably be discussed...
Comment #4
yched commentedbesides, storing and displaying 'off_value' is the D5 behavior, so we definitely want that.
I'll try to look into this tomorrow.
Comment #5
wrunt commentedI ran across this bug too. I agree that the value stored should be the off_value, not 0. Here's a patch to do that. It works with a single on/off text field. Haven't tested with single on/off integer fields though.
Comment #6
yched commentedThat's right - committed.
Thanks !
Our tests are now a sea of green :-)
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.