Skip to content

Commit

Permalink
"maxlength" is not a valid attribute for input element of type "numbe…
Browse files Browse the repository at this point in the history
…r" in html5.
  • Loading branch information
ADmad committed Apr 11, 2013
1 parent b210849 commit 548cccb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/View/Helper/FormHelperTest.php
Expand Up @@ -748,7 +748,7 @@ public function testTextFieldGenerationForFloats() {
'type' => 'float',
'null' => false,
'default' => null,
'length' => null
'length' => 10
)));

$this->Form->create('Contact');
Expand Down Expand Up @@ -1841,7 +1841,7 @@ public function testInput() {
'label' => array('for'),
'Balance',
'/label',
'input' => array('name', 'type' => 'number', 'maxlength' => 8, 'id'),
'input' => array('name', 'type' => 'number', 'id'),
'/div',
);
$this->assertTags($result, $expected);
Expand Down
5 changes: 1 addition & 4 deletions lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -1242,13 +1242,10 @@ protected function _maxLength($options) {
$options['type'] !== 'select'
);
if ($autoLength &&
in_array($options['type'], array('text', 'email', 'tel', 'url'))
in_array($options['type'], array('text', 'email', 'tel', 'url', 'search'))
) {
$options['maxlength'] = $fieldDef['length'];
}
if ($autoLength && $fieldDef['type'] === 'float') {
$options['maxlength'] = array_sum(explode(',', $fieldDef['length'])) + 1;
}
return $options;
}

Expand Down

0 comments on commit 548cccb

Please sign in to comment.