Commit a78d8b59 authored by Carsten Brandt's avatar Carsten Brandt

fixed issue with wrongly assigned label in bootstrap

fixes #5984
parent 9db3d652
...@@ -376,6 +376,9 @@ class ActiveField extends \yii\widgets\ActiveField ...@@ -376,6 +376,9 @@ class ActiveField extends \yii\widgets\ActiveField
$label = Html::encode($this->model->getAttributeLabel($attribute)); $label = Html::encode($this->model->getAttributeLabel($attribute));
} }
} }
if (!isset($options['for'])) {
$options['for'] = Html::getInputId($this->model, $this->attribute);
}
$this->parts['{beginLabel}'] = Html::beginTag('label', $options); $this->parts['{beginLabel}'] = Html::beginTag('label', $options);
$this->parts['{endLabel}'] = Html::endTag('label'); $this->parts['{endLabel}'] = Html::endTag('label');
$this->parts['{labelTitle}'] = $label; $this->parts['{labelTitle}'] = $label;
......
...@@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log ...@@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log
2.0.4 under development 2.0.4 under development
----------------------- -----------------------
- no changes in this release. - Bug #5984: `yii\bootstrap\Activefield::checkbox()` caused browser to link label to the wrong input (cebe)
2.0.3 March 01, 2015 2.0.3 March 01, 2015
......
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