Hidden filed bug


(Cálcio) #1

Hi guys

When I use a hidden field created by Yii, it include a new blank line and brake a grid layout on my View. Is it occur with you too?


(Bizley) #2

How do you insert it in your view?


(Cálcio) #3

@Bizley I’m trying it.


<?= $form->field($model, 'name')->hiddenInput()->label('') ?>

Other bug that I noticed is the label always appears. So I need put the ->label(’’) to hide it to.


(Bizley) #4

I’ve checked it and this is how it should be done:

  1. To remove label you should use

->label(false)

  1. Method \yii\widgets\ActiveField::hiddenInput() is provided only for completeness. Because there is no need to validate such field in most cases you should use

\yii\helpers\Html::activeHiddenInput()


(Cálcio) #5

Thanks @Bizley, I’ll chek it.