Answer the question
In order to leave comments, you need to log in
How to place fields in yii2?
Good day!
I can not figure out how to place the columns in the required sequence.
It is necessary that it looks like this:
But I have everything in one column, I try this:
<?php $form = ActiveForm::begin([
'id' => 'save-form',
'layout' => 'horizontal',
'fieldConfig' => [
'template' => "{label}\n
<div class=\"col-lg-4\">
{input}
</div>\n
",
'labelOptions' => ['class' => 'col-lg-2 control-label'],
],
]); ?>
<?= $form->field($model, 'type')->textInput() ?>
<?= $form->field($model, 'number')->textInput() ?>
<?= $form->field($model, 'region')->textInput(['maxlength' => true]) ?>
'template' => "{label}\n
<div class=\"col-lg-4\">
{input}
</div>\n
{label}\n
<div class=\"col-lg-4\">
{input}
</div>\n
",
Answer the question
In order to leave comments, you need to log in
Good morning.
The simplest and most effective option
<div class="col-lg-6">
<?= $form->field($model, 'type')->textInput() ?>
<?= $form->field($model, 'number')->textInput() ?>
<?= $form->field($model, 'region')->textInput(['maxlength' => true]) ?>
</div>
<div class="col-lg-6">
<?= $form->field($model, 'type')->textInput() ?>
<?= $form->field($model, 'number')->textInput() ?>
<?= $form->field($model, 'region')->textInput(['maxlength' => true]) ?>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question