Merge pull request #4975 from ptica/disabled-hidden-input

Disable the hidden input for multi checkbox inputs when inputs are disabled.
This commit is contained in:
Mark Story 2014-10-25 20:12:35 -04:00
commit 5b32fd7e25
2 changed files with 4 additions and 3 deletions

View file

@ -2695,7 +2695,7 @@ class FormHelperTest extends CakeTestCase {
array('label' => array('for' => "ContactMultiple")),
'Multiple',
'/label',
array('input' => array('type' => 'hidden', 'name' => "data[Contact][multiple]", 'value' => '', 'id' => "ContactMultiple")),
array('input' => array('type' => 'hidden', 'name' => "data[Contact][multiple]", 'value' => '', 'id' => "ContactMultiple", 'disabled' => 'disabled')),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => "data[Contact][multiple][]", 'value' => 1, 'disabled' => 'disabled', 'id' => "ContactMultiple1")),
array('label' => array('for' => "ContactMultiple1")),
@ -5004,7 +5004,7 @@ class FormHelperTest extends CakeTestCase {
'Multiple',
'/label',
'input' => array(
'type' => 'hidden', 'name' => 'data[Contact][multiple]', 'value' => '', 'id' => 'ContactMultiple_'
'type' => 'hidden', 'name' => 'data[Contact][multiple]', 'value' => '', 'id' => 'ContactMultiple_', 'disabled' => 'disabled'
),
'select' => array(
'name' => 'data[Contact][multiple][]', 'disabled' => 'disabled', 'multiple' => 'multiple', 'id' => 'ContactMultiple'

View file

@ -2069,7 +2069,8 @@ class FormHelper extends AppHelper {
'id' => $attributes['id'] . ($style ? '' : '_'),
'secure' => false,
'form' => isset($attributes['form']) ? $attributes['form'] : null,
'name' => $attributes['name']
'name' => $attributes['name'],
'disabled' => $attributes['disabled'] === true || $attributes['disabled'] === 'disabled'
);
$select[] = $this->hidden(null, $hiddenAttributes);
}