Commits

Christoffer Niska committed 2d3de51

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

Comments (0)

Files changed (2)

widgets/input/BootInputHorizontal.php

 	 */
 	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>';
 	}
 	 */
 	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>';
 	}

widgets/input/BootInputVertical.php

 	 */
 	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>';
 	}
 	 */
 	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>';
 	}