Skip to content
Permalink
Browse files

"maxlength" is not a valid attribute for input element of type "numbe…

…r" in html5.
  • Loading branch information...
ADmad committed Apr 11, 2013
1 parent b210849 commit 548cccbbe24dfd437d18610befa69dd927e0317d
Showing with 3 additions and 6 deletions.
  1. +2 −2 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
  2. +1 −4 lib/Cake/View/Helper/FormHelper.php
@@ -748,7 +748,7 @@ public function testTextFieldGenerationForFloats() {
'type' => 'float',
'null' => false,
'default' => null,
'length' => null
'length' => 10
)));
$this->Form->create('Contact');
@@ -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);
@@ -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;
}

0 comments on commit 548cccb

Please sign in to comment.
You can’t perform that action at this time.