V
V
Vladimir2016-09-19 14:14:29
Yii
Vladimir, 2016-09-19 14:14:29

How to split a form in Yii2 into two parts?

Good day! There is a form and I would like to break it into two parts. I want to break it with bootstrap. Tried to make two columns .col-sm-6*2, half of the fields

<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
placed in one div and placed the second part in another div. The first div fires client-side validation, but the second div doesn't. What can it be and how to break them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-19
@MasterGerold

Good afternoon.
Everything should work without problems.
I hope you split only the input and not the whole form?

<?php $form = ActiveForm::begin(); ?>
    <div class="col-sm-6">
      <?= $form->field($model, 'title1')->textInput(['maxlength' => true]) ?>
    </div>
    <div class="col-sm-6">
      <?= $form->field($model, 'title2')->textInput(['maxlength' => true]) ?>
    </div>
    <div class="form-group">
        // тут кнопка
    </div>

 <?php ActiveForm::end(); ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question