mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
Fixes #7946 Fixed a bug when the form attribute was not propagated to the hidden input of the checkbox
This commit is contained in:
committed by
Alexander Makarov
parent
953a0bba2b
commit
f47b6c7683
@ -60,6 +60,7 @@ class BaseHtml
|
||||
'href',
|
||||
'src',
|
||||
'srcset',
|
||||
'form',
|
||||
'action',
|
||||
'method',
|
||||
|
||||
@ -742,7 +743,11 @@ class BaseHtml
|
||||
$value = array_key_exists('value', $options) ? $options['value'] : '1';
|
||||
if (isset($options['uncheck'])) {
|
||||
// add a hidden field so that if the checkbox is not selected, it still submits a value
|
||||
$hidden = static::hiddenInput($name, $options['uncheck']);
|
||||
$hiddenOptions = [];
|
||||
if (isset($options['form'])) {
|
||||
$hiddenOptions['form'] = $options['form'];
|
||||
}
|
||||
$hidden = static::hiddenInput($name, $options['uncheck'], $hiddenOptions);
|
||||
unset($options['uncheck']);
|
||||
} else {
|
||||
$hidden = '';
|
||||
|
||||
Reference in New Issue
Block a user