mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #8754 from schrolli/form-patch
2.next: FormHelper added field type "time" sothat no "maxlength" attribute is set
This commit is contained in:
commit
0d61b46822
2 changed files with 53 additions and 0 deletions
|
@ -66,6 +66,8 @@ class Contact extends CakeTestModel {
|
||||||
'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'phone' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'phone' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'password' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'password' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
|
'lap_time' => array('type' => 'time', 'null' => '', 'default' => '', 'length' => '2'),
|
||||||
|
'last_seen' => array('type' => 'datetime', 'null' => '', 'default' => '', 'length' => '3'),
|
||||||
'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null),
|
'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null),
|
||||||
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null),
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null),
|
||||||
|
@ -3344,6 +3346,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input time')),
|
||||||
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input datetime')),
|
||||||
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
|
@ -3369,6 +3375,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input time')),
|
||||||
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input datetime')),
|
||||||
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
|
@ -3399,6 +3409,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input time')),
|
||||||
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input datetime')),
|
||||||
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
|
@ -3425,6 +3439,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input time')),
|
||||||
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input datetime')),
|
||||||
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
|
@ -3458,6 +3476,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input time')),
|
||||||
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input datetime')),
|
||||||
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
|
@ -3488,6 +3510,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input time')),
|
||||||
|
'*/div',
|
||||||
|
array('div' => array('class' => 'input datetime')),
|
||||||
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input date')),
|
array('div' => array('class' => 'input date')),
|
||||||
|
@ -7678,6 +7704,31 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->assertContains('value="2008" selected="selected"', $result);
|
$this->assertContains('value="2008" selected="selected"', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testInputTimeWithMicrosecondsAsText method
|
||||||
|
*
|
||||||
|
* since times and datetimes can now have a Length, specifying the microsecond
|
||||||
|
* precision, a text-type input shouldn't have set a maxLength attribute.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testInputTimeWithMicrosecondsAsText() {
|
||||||
|
$this->Form->request->data = array();
|
||||||
|
$this->Form->create('Contact');
|
||||||
|
$result = $this->Form->input('lap_time',
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertNotContains('maxlength=', $result);
|
||||||
|
$result = $this->Form->input('last_seen',
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertNotContains('maxlength=', $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testTextArea method
|
* testTextArea method
|
||||||
*
|
*
|
||||||
|
|
|
@ -1309,6 +1309,8 @@ class FormHelper extends AppHelper {
|
||||||
is_scalar($fieldDef['length']) &&
|
is_scalar($fieldDef['length']) &&
|
||||||
$fieldDef['length'] < 1000000 &&
|
$fieldDef['length'] < 1000000 &&
|
||||||
$fieldDef['type'] !== 'decimal' &&
|
$fieldDef['type'] !== 'decimal' &&
|
||||||
|
$fieldDef['type'] !== 'time' &&
|
||||||
|
$fieldDef['type'] !== 'datetime' &&
|
||||||
$options['type'] !== 'select'
|
$options['type'] !== 'select'
|
||||||
);
|
);
|
||||||
if ($autoLength &&
|
if ($autoLength &&
|
||||||
|
|
Loading…
Reference in a new issue