I have an active form which currently displays checkboxlists horizontally but I would like it to display them vertically. I have set the form layout to vertical but it still displays them horizontally:
This is what I have tried:
//generates an array of permissions
$options = Permission::value_list(
Permission::findWhere()->select('name')->andWhere(['not', ['name' => $name]])->all(),
['name']
);
This is the form
<?php $form = ActiveForm::begin(['layout' => 'vertical']); ?>
<?= $form->field($model, 'item_children')
->checkboxList($options)->label(sprintf("Available %s", $assigning))
->hint("Which type of authorization item are you creating") ?>
What do I need to add: currently they are displayed in this way.

I would like the displayed vertically.
You could use the separator option mentioned here: http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#activeCheckboxList()-detail
Your call would then look like this for example:
<?php $form = ActiveForm::begin(['layout' => 'vertical']); ?>
<?= $form->field($model, 'item_children')
->checkboxList($options, ['separator'=>'<br/>'])
->label(sprintf("Available %s", $assigning))
->hint("Which type of authorization item are you creating") ?>
Or whatever you want to use as the separator in your specific case.
Hope that helps...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With