F
F
fiter2018-08-24 20:22:58
Yii
fiter, 2018-08-24 20:22:58

How to change checkbox template in Yii2?

Hello!
In the standard template, the checkbox is inside the label, I need to pull it out:

<div class="check">
  <input type="checkbox" id="dogovor">
  <label for="dogovor">Принять <a href="#">Условия договора</a></label>
</div>

I'm working with Yii2 for the first time, plz tell me in which file I need to change the template so that all checkboxes are displayed as I need

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-08-25
@fiter

Good morning.

<?= $form->field($model, 'clickwrap', [
                  'template' => "<div class=\"check\">{input}{label}</div>\n<div class=\"col-lg-8\">{error}</div>"
                ])->checkbox([],false)
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question