Chekboxrow, Label remove #411

MPeli opened this Issue Mar 25, 2013 · 4 comments


None yet
4 participants

MPeli commented Mar 25, 2013


I am able to generate a checkbox using following line of code:

// bootstrap.widgets.TbActiveForm 
$form->checkboxRow($model, 'setMenu');

I would like to remove the label. I tried something this:

$form->checkboxRow($model, 'setMenu', array('labelOptions' => array("label" => false));

However, the label did not disappear. How can I remove the label?


$form->textareaRow($model, 'setMenu[bulk]['.$mtid.']', array('labelOptions' => array("label" => false)));

works fine and the textarea is rendered without a label.

Thank you, Martin.

MPeli commented Mar 25, 2013

I modified function TbInput::getLabel()

    protected function getLabel()
        if ($this->label !== false && $this->hasModel())
            return $this->form->labelEx($this->model, $this->attribute, $this->labelOptions);
        else if ($this->label !== null)
            return $this->label;
            return '';

and function TbInputVertical::checkBox()

    protected function checkBox()
        echo $this->getLabel();
        echo $this->form->checkBox($this->model, $this->attribute, $this->htmlOptions) . PHP_EOL;
        echo $this->getError() . $this->getHint();

Everything seems to work now and I am able to generate a checkbox without a label.


magefad commented Mar 29, 2013

With code avode checkbox echo's only without label..
Int'so no way now to hide input label, see oficial yiisoft/yii#373 in milesnote yii 1.1.14
Problem with CHtml, not yiibooster.


hijarian commented Apr 7, 2013

OK, so, wontfix, then.

hijarian closed this Apr 7, 2013

This turned me crazy too. I solved it with a simple css hack:

label.checkbox {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment