akorinek
(Andreas)
December 19, 2014, 12:48am
1
I built an activeform in yii 2.0.1 and added a bunch of hiddenInput fields like so:
<?= $form->field($model, 'id')->hiddenInput()->label('') ?>
The issue is that these field take up real estate on the form. Is this intentional? How can I make the fields not take up space?
Hodges
(Dev)
December 19, 2014, 1:05am
2
The easiest way is to just put them in a hidden div like so:
<div class="hide">
<?php echo $form->field($model,'id')->hiddenInput(); ?>
<?php echo $form->field($model,'event_type')->hiddenInput(); ?>
</div>
akorinek
(Andreas)
December 19, 2014, 1:30am
3
That works nicely, thanks. Maybe this should be included in the hiddenInput default html rendering, I cannot think of a use case where the hidden input should influence the form layout.
Hodges
(Dev)
December 19, 2014, 2:53am
4
glad to hear it. Mind upvoting my response? Hopefully others will see it and yes it probably should be included by default.