If I am using a field with multiple checkboxes and I try to uncheck all of the boxes I get the following:
error : warning: Illegal offset type in /includes/form.inc on line 1213.
This seems to be related to this chunk of code from editablefields.module
/* it seems that the serializer does not serialize e.g. un-checked
* checkboxes. Leaving them as empty arrays. This FILTHY hack fills in the
* array with 'something' so that when the form is executed, it fills in the
* right value - I dislike this code - JMB */
if (is_array($node->{$field_name})) {
$field = content_fields($field_name, $node->type);
$items = &$form_state['values'][$field_name];
if (empty($items)) {
foreach (array_keys($field['columns']) as $column) {
if ($field['multiple']) {
$items[$delta][$column][] = NULL;
}
else {
<strong> $items[$column] = NULL;
}
}
}
I made a guess that the line:
$items[$delta][$column][] = NULL;
should actually look like:
$items[$delta][$column] = NULL;
This made the error go away, and as far as I can tell it hasn't broken anything. Seems to make sense given the error message. My patch contains that change.
| Comment | File | Size | Author |
|---|---|---|---|
| uncheck-all-error-0.patch | 487 bytes | mry4n |
Comments
Comment #1
joelpittetLast update was 2012, going to close as outdated because it's against 6.x branch.