mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
FormHelper::checkbox() now sets name of hidden field when name option is set. Closes #5224
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7449 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
3a06f840c3
commit
a180071f6c
2 changed files with 8 additions and 1 deletions
|
@ -823,7 +823,7 @@ class FormHelper extends AppHelper {
|
|||
$value = $db->boolean($options['value'], false);
|
||||
$options['value'] = 1;
|
||||
}
|
||||
$output = $this->hidden($fieldName, array('value' => '0', 'id' => $options['id'] . '_'), true);
|
||||
$output = $this->hidden($fieldName, array('name' => $options['name'], 'value' => '0', 'id' => $options['id'] . '_'), true);
|
||||
|
||||
if (isset($options['value']) && $value == $options['value']) {
|
||||
$options['checked'] = 'checked';
|
||||
|
|
|
@ -2426,6 +2426,13 @@ class FormHelperTest extends CakeTestCase {
|
|||
array('input' => array('type' => 'checkbox', 'name' => 'data[CustomField][1][value]', 'value' => '1', 'id' => 'CustomField1Value'))
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->checkbox('Test.test', array('name' => 'myField'));
|
||||
$expected = array(
|
||||
'input' => array('type' => 'hidden', 'name' => 'myField', 'value' => '0', 'id' => 'TestTest_'),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'myField', 'value' => '1', 'id' => 'TestTest'))
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
/**
|
||||
* testDateTime method
|
||||
|
|
Loading…
Add table
Reference in a new issue