When building a webform using options_element I noticed that an option with the value '0' could not be created. This is due to the filtering in _form_options_from_text(). Two changes in the first 10 lines were necessary to correct this:
$rows = array_filter(explode("\n", trim($text)), '_options_element_filter_options');
and
if (empty($row)&&!strlen($row)) {
This also uses a new function:
function _options_element_filter_options($value) {
return (bool)$value || strlen($value);
}
With these modifications, it correctly saves the '0' value.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | options_element_1796802_zero_value.patch | 712 bytes | liam morland |
Comments
Comment #1
liam morlandHere is a patch which does in effect the same as the changes above. It works for me.
Comment #2
quicksketchThanks guys! Committed to both 1.x branches.