pluf2

pluf2 Commit Details


Date:2008-11-21 06:57:30 (16 years 1 month ago)
Author:Loic d'Anterroches
Branch:master
Commit:161080f312c4eb24c6d508adfcebdc6745e29428
Parents: 1aa66025b77aeb5a17860888652762b368e14fee
Message:Fixed issue with the checkbox not correctly unchecked.

Changes:

File differences

src/Pluf/Form/Widget/CheckboxInput.php
4343
4444
4545
46
47
48
49
46
47
48
5049
5150
5251
......
5857
5958
6059
61
62
60
61
6362
6463
6564
// true, then we check the box.
$extra_attrs['checked'] = 'checked';
}
// We force the value to '', the "real" value is passed
// through the extra_attrs. This is because a checkbox can
// have a value and also the checked/unchecked state.
return parent::render($name, '', $extra_attrs);
// Value of a checkbox is always "1" but when not checked, the
// corresponding key in the form associative array is not set.
return parent::render($name, '1', $extra_attrs);
}
/**
*/
public function valueFromFormData($name, $data)
{
if (!isset($data[$name])
or false === $data[$name] or (string)$data[$name] === '0') {
if (!isset($data[$name]) or false === $data[$name]
or (string)$data[$name] === '0' or $data[$name] == '') {
return false;
}
return true;

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05295s using 13 queries.