Commit ec663c36 by Qiang Xue

Merge pull request #2004 from klevron/1998

Fixes #1998 : get input value from hidden field when necessary
parents 3c05ee51 6594fbd2
......@@ -31,6 +31,7 @@ Yii Framework 2 Change Log
- Bug #1959: `Html::activeCheckbox` wasn't respecting custom values for checked/unchecked state (klevron, samdark)
- Bug #1965: `Controller::findLayoutFile()` returns incorrect file path when layout name starts with a slash (qiangxue)
- Bug #1993: afterFind event in AR is now called after relations have been populated (cebe, creocoder)
- Bug #1998: Unchecked required checkbox never pass client validation (klevron)
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
- Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark)
- Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
......
......@@ -381,7 +381,11 @@
var $input = findInput($form, attribute);
var type = $input.prop('type');
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 {
return $input.val();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment