Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix disabled attribute check.

Fixes #3818
  • Loading branch information...
commit 91319bbe7bc665befc67a5d2e6db6490354819fb 1 parent 3720897
@ADmad ADmad authored
View
22 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -2205,6 +2205,28 @@ public function testInputCheckbox() {
'/div'
);
$this->assertTags($result, $expected);
+
+ $result = $this->Form->input('User.disabled', array(
+ 'label' => 'Disabled',
+ 'type' => 'checkbox',
+ 'data-foo' => 'disabled'
+ ));
+ $expected = array(
+ 'div' => array('class' => 'input checkbox'),
+ 'input' => array('type' => 'hidden', 'name' => 'data[User][disabled]', 'value' => '0', 'id' => 'UserDisabled_'),
+ array('input' => array(
+ 'type' => 'checkbox',
+ 'name' => 'data[User][disabled]',
+ 'value' => '1',
+ 'id' => 'UserDisabled',
+ 'data-foo' => 'disabled'
+ )),
+ 'label' => array('for' => 'UserDisabled'),
+ 'Disabled',
+ '/label',
+ '/div'
+ );
+ $this->assertTags($result, $expected);
}
/**
View
2  lib/Cake/View/Helper/FormHelper.php
@@ -2809,7 +2809,7 @@ protected function _initInputField($field, $options = array()) {
}
$disabledIndex = array_search('disabled', $options, true);
- if ($disabledIndex !== false) {
+ if (is_int($disabledIndex)) {
unset($options[$disabledIndex]);
$options['disabled'] = true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.