Fixes #7946 Fixed a bug when the form attribute was not propagated to the hidden input of the checkbox

This commit is contained in:
Nikolay Oleynikov
2017-02-27 13:47:37 +03:00
committed by Alexander Makarov
parent 953a0bba2b
commit f47b6c7683
3 changed files with 14 additions and 1 deletions

View File

@ -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 = '';