mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
Fixes #1998 : get input value from hidden field when necessary(unchecked checkbox/radio)
This commit is contained in:
@ -381,7 +381,11 @@
|
|||||||
var $input = findInput($form, attribute);
|
var $input = findInput($form, attribute);
|
||||||
var type = $input.prop('type');
|
var type = $input.prop('type');
|
||||||
if (type === 'checkbox' || type === 'radio') {
|
if (type === 'checkbox' || type === 'radio') {
|
||||||
return $input.filter(':checked').val();
|
var $realInput = $input.filter(':checked');
|
||||||
|
if (!$realInput.length) {
|
||||||
|
$realInput = $form.find('input[type=hidden][name="'+$input.prop('name')+'"]');
|
||||||
|
}
|
||||||
|
return $realInput.val();
|
||||||
} else {
|
} else {
|
||||||
return $input.val();
|
return $input.val();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user