Hide label for input field

Joshi picture Joshi · Nov 19, 2014 · Viewed 53.9k times · Source

I am trying to hide the label for a specific field in _form.php without success.

I have tried couple of variation like, but none is working:

<?= $form->field($model, 'sample_text')->textArea('label'=>false) ?>

and alternate code:

<?= $form->field($model, 'sample_text')->textArea('label'=>'') ?>

What is the right approach to hide a label?

Answer

Joshi picture Joshi · Nov 19, 2014

Ok, I found the solution.

<?= $form->field($model, 'sample_text')->textArea()->label(false) ?>