mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #1225 from ADmad/2.3-input-number
"maxlength" is not a valid attribute for input element of type "number" ...
This commit is contained in:
commit
5e00fdfce5
2 changed files with 3 additions and 6 deletions
|
@ -748,7 +748,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'type' => 'float',
|
'type' => 'float',
|
||||||
'null' => false,
|
'null' => false,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'length' => null
|
'length' => 10
|
||||||
)));
|
)));
|
||||||
|
|
||||||
$this->Form->create('Contact');
|
$this->Form->create('Contact');
|
||||||
|
@ -1841,7 +1841,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'label' => array('for'),
|
'label' => array('for'),
|
||||||
'Balance',
|
'Balance',
|
||||||
'/label',
|
'/label',
|
||||||
'input' => array('name', 'type' => 'number', 'maxlength' => 8, 'id'),
|
'input' => array('name', 'type' => 'number', 'id'),
|
||||||
'/div',
|
'/div',
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
|
@ -1242,13 +1242,10 @@ class FormHelper extends AppHelper {
|
||||||
$options['type'] !== 'select'
|
$options['type'] !== 'select'
|
||||||
);
|
);
|
||||||
if ($autoLength &&
|
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'];
|
$options['maxlength'] = $fieldDef['length'];
|
||||||
}
|
}
|
||||||
if ($autoLength && $fieldDef['type'] === 'float') {
|
|
||||||
$options['maxlength'] = array_sum(explode(',', $fieldDef['length'])) + 1;
|
|
||||||
}
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue