diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 9da345458..340247be0 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -2650,6 +2650,29 @@ class FormHelperTest extends CakeTestCase { '/div' ); $this->assertTags($result, $expected); + + $this->View->viewVars['balances'] = array(0 => 'nothing', 1 => 'some', 100 => 'a lot'); + $this->Form->request->data = array('ValidateUser' => array('balance' => 1)); + $result = $this->Form->input('ValidateUser.balance'); + $expected = array( + 'div' => array('class' => 'input select'), + 'label' => array('for' => 'ValidateUserBalance'), + 'Balance', + '/label', + 'select' => array('name' => 'data[ValidateUser][balance]', 'id' => 'ValidateUserBalance'), + array('option' => array('value' => '0')), + 'nothing', + '/option', + array('option' => array('value' => '1', 'selected' => 'selected')), + 'some', + '/option', + array('option' => array('value' => '100')), + 'a lot', + '/option', + '/select', + '/div' + ); + $this->assertTags($result, $expected); } /** diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 1fb8d7a81..6d82b2865 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -1006,12 +1006,17 @@ class FormHelper extends AppHelper { } $options['options'] = $varOptions; } + + if ($options['type'] === 'select' && array_key_exists('step', $options)) { + unset($options['step']); + } } $autoLength = ( !array_key_exists('maxlength', $options) && isset($fieldDef['length']) && - is_scalar($fieldDef['length']) + is_scalar($fieldDef['length']) && + $options['type'] !== 'select' ); if ($autoLength && $options['type'] == 'text') { $options['maxlength'] = $fieldDef['length'];