Commit 436defd3 by niskac

fixed a bug that caused checkbox and radio attributes to be resolved twice (fixes #52)

parent fc2d9ee0
......@@ -47,10 +47,11 @@ class BootInputHorizontal extends BootInput
*/
protected function checkBox()
{
$attribute = $this->attribute;
echo '<div class="controls">';
echo '<label class="checkbox" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $this->attribute)).'">';
echo $this->form->checkBox($this->model, $this->attribute, $this->htmlOptions).PHP_EOL;
echo $this->model->getAttributeLabel($this->attribute);
echo '<label class="checkbox" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $attribute)).'">';
echo $this->form->checkBox($this->model, $attribute, $this->htmlOptions).PHP_EOL;
echo $this->model->getAttributeLabel($attribute);
echo $this->getError().$this->getHint();
echo '</label></div>';
}
......@@ -123,10 +124,11 @@ class BootInputHorizontal extends BootInput
*/
protected function radioButton()
{
$attribute = $this->attribute;
echo '<div class="controls">';
echo '<label class="radio" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $this->attribute)).'">';
echo $this->form->radioButton($this->model, $this->attribute, $this->htmlOptions).PHP_EOL;
echo $this->model->getAttributeLabel($this->attribute);
echo '<label class="radio" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $attribute)).'">';
echo $this->form->radioButton($this->model, $attribute, $this->htmlOptions).PHP_EOL;
echo $this->model->getAttributeLabel($attribute);
echo $this->getError().$this->getHint();
echo '</label></div>';
}
......
......@@ -34,9 +34,10 @@ class BootInputVertical extends BootInput
*/
protected function checkBox()
{
echo '<label class="checkbox" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $this->attribute)).'">';
$attribute = $this->attribute;
echo '<label class="checkbox" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $attribute)).'">';
echo $this->form->checkBox($this->model, $this->attribute, $this->htmlOptions).PHP_EOL;
echo $this->model->getAttributeLabel($this->attribute);
echo $this->model->getAttributeLabel($attribute);
echo $this->getError().$this->getHint();
echo '</label>';
}
......@@ -101,9 +102,10 @@ class BootInputVertical extends BootInput
*/
protected function radioButton()
{
echo '<label class="radio" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $this->attribute)).'">';
$attribute = $this->attribute;
echo '<label class="radio" for="'.CHtml::getIdByName(CHtml::resolveName($this->model, $attribute)).'">';
echo $this->form->radioButton($this->model, $this->attribute, $this->htmlOptions).PHP_EOL;
echo $this->model->getAttributeLabel($this->attribute);
echo $this->model->getAttributeLabel($attribute);
echo $this->getError().$this->getHint();
echo '</label>';
}
......
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