I would like to have a textInput
with a label hidden, what I would like to show later via onChange. I have searched quite a lot, but found nothing. Either I turn it off with ->label(false)
, or leave it on. Is there a way to implement ->label(['style' => 'display: none'])
somehow, as it's working with ->textInput(['style' => 'display: none'])
?
Thank you.
The first argument of ActiveField::label()
method is the string used as label, the second one is options. You can pass null in first argument to let the ActiveField widget use getAttributeLabel()
method of your model.
The code should look like this:
$form->field($model, 'attribute')->label(null, ['style' => 'display: none']);
Or you can pass options to label directly from field method like this:
$form->field($model, 'attribute', ['labelOptions' => ['style' => 'display: none']]);