You currently cannot uncheck a selected checkbox - _submit handler keep receiving '1' for the value of the checkbox.
Example : try to unpublish a node using the node edit form.

Only single #checkbox seems to be affected? #checkboxes work fine (or this would have been noticed before, I guess...)

CommentFileSizeAuthor
#3 form.inc_1.215.txt869 bytesAjK

Comments

yched’s picture

Not sure that's relevant, but $form['#post'] has no value for an unchecked checkbox.

So on those lines in _form_builder_handle_input_element (form.inc line 802) :

$edit = $form['#post'];
foreach ($form['#parents'] as $parent) {
  $edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
}

$edit gets set to NULL, and $form['#value'] never gets set by form_type_checkbox_value, so with '#default_value' and the checkbox stays checked.

yched’s picture

er, the end of the previous post should read :
'... so we stick to '#default_value' and the checkbox stays checked.'

AjK’s picture

Status: Active » Needs review
StatusFileSize
new869 bytes

Well, we're both looking in the same ball park (and we're both obviously working on it at the same time, shame you're not in #drupal right now).

Anyway, the attached patched fixed it for me (and it's right on the node of your observations above).

However, this patch does need Eaton or Chx to review

eaton’s picture

Status: Needs review » Closed (duplicate)

The root of this problem is serious -- the WRONG version of this patch (http://drupal.org/node/121620) was committed to core. The last version of the patch in that issue fixes this issue as well as a couple of other bits.