Don't disable the entire select when disabled is array(1)

When the disabled attribute is just array(1), then the attribute should
be filtered out of select element attributes. This is kind of a hacky
workaround but changing the underlying attribute handling is going to be
pretty tricky and far more dangerous.

Fixes #3546
This commit is contained in:
mark_story 2014-05-23 13:26:11 -04:00
parent 81875cfeb1
commit db86b0c050
2 changed files with 9 additions and 5 deletions

View file

@ -4939,7 +4939,7 @@ class FormHelperTest extends CakeTestCase {
*/
public function testSelectMultipleWithDisabledElements() {
$options = array(1 => 'One', 2 => 'Two', '3' => 'Three', '3x' => 'Stringy');
$disabled = array(2, 3);
$disabled = array(1);
$result = $this->Form->select('Contact.multiple', $options, array('multiple' => 'multiple', 'disabled' => $disabled));
$expected = array(
'input' => array(
@ -4948,13 +4948,13 @@ class FormHelperTest extends CakeTestCase {
'select' => array(
'name' => 'data[Contact][multiple][]', 'multiple' => 'multiple', 'id' => 'ContactMultiple'
),
array('option' => array('value' => '1')),
array('option' => array('value' => '1', 'disabled' => 'disabled')),
'One',
'/option',
array('option' => array('value' => '2', 'disabled' => 'disabled')),
array('option' => array('value' => '2')),
'Two',
'/option',
array('option' => array('value' => '3', 'disabled' => 'disabled')),
array('option' => array('value' => '3')),
'Three',
'/option',
array('option' => array('value' => '3x')),