diff --git a/widgets/input/BootInput.php b/widgets/input/BootInput.php index 91751b4..a4d7ad7 100644 --- a/widgets/input/BootInput.php +++ b/widgets/input/BootInput.php @@ -202,6 +202,17 @@ protected function getAppend($htmlOptions = array()) else return ''; } + + /** + * Returns the id that should be used for the specified attribute + * @param string $attribute the attribute + * @return string the id + */ + protected function getAttributeId($attribute) + { + return isset($this->htmlOptions['id']) ? $this->htmlOptions['id'] : + CHtml::getIdByName(CHtml::resolveName($this->model, $attribute)); + } /** * Returns the input container CSS classes. diff --git a/widgets/input/BootInputHorizontal.php b/widgets/input/BootInputHorizontal.php index c5c8e1c..319634e 100644 --- a/widgets/input/BootInputHorizontal.php +++ b/widgets/input/BootInputHorizontal.php @@ -37,6 +37,9 @@ protected function getLabel($htmlOptions = array()) $htmlOptions['class'] .= ' '.$classes; else $htmlOptions['class'] = $classes; + + if(isset($this->htmlOptions['id'])) + $htmlOptions['for'] = $this->htmlOptions['id']; return parent::getLabel($htmlOptions); } @@ -49,7 +52,7 @@ protected function checkBox() { $attribute = $this->attribute; echo '
'; - echo '