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?
The hidden attribute hides the <label> element. You can specify either 'hidden' (without value) or 'hidden="hidden"'. Both are valid. A hidden <label> element is not visible, but it maintains its position on the page.
Go to Customize menu and then click on 'Styles & Layouts GF Forms'. You now need to select the form for which you want to hide labels and sub-labels. After selecting form you will see plenty of design controls. Open the Field Labels section and then click on 'Hide Labels' setting.
Ok, I found the solution.
<?= $form->field($model, 'sample_text')->textArea()->label(false) ?>
Or you can modify template
value for particular field and remove {label}
part from it. I.e.:
<p><?= $form->field($page, 'image', [ 'template' => '<div class=\"\">{input}</div><div class=\"\">{error}</div>' ])->fileInput() ?></p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With