mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed the input name when multiple is setted to false.
This commit is contained in:
parent
54a4d24a03
commit
2c4ed9bfc2
2 changed files with 21 additions and 1 deletions
|
@ -1454,7 +1454,7 @@ class FormHelper extends AppHelper {
|
|||
$selected = $attributes['value'];
|
||||
}
|
||||
|
||||
if (isset($attributes) && array_key_exists('multiple', $attributes)) {
|
||||
if (!empty($attributes['multiple'])) {
|
||||
$style = ($attributes['multiple'] === 'checkbox') ? 'checkbox' : null;
|
||||
$template = ($style) ? 'checkboxmultiplestart' : 'selectmultiplestart';
|
||||
$tag = $this->Html->tags[$template];
|
||||
|
|
|
@ -3360,6 +3360,26 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/select'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->select(
|
||||
'Model.multi_field', $options, array(0, 1), array('multiple' => false)
|
||||
);
|
||||
$expected = array(
|
||||
'select' => array(
|
||||
'name' => 'data[Model][multi_field]', 'id' => 'ModelMultiField'
|
||||
),
|
||||
array('option' => array('value' => '0', 'selected' => 'selected')),
|
||||
'first',
|
||||
'/option',
|
||||
array('option' => array('value' => '1', 'selected' => 'selected')),
|
||||
'second',
|
||||
'/option',
|
||||
array('option' => array('value' => '2')),
|
||||
'third',
|
||||
'/option',
|
||||
'/select'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue