我有一个活动的表单,当前水平显示复选框列表,但我希望它垂直显示它们.我已将表单布局设置为垂直,但它仍然水平显示:
这是我尝试过的:
//generates an array of permissions
$options = Permission::value_list(
Permission::findWhere()->select('name')->andWhere(['not', ['name' => $name]])->all(),
['name']
);
这是表格
<?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") ?>
我需要添加什么:目前它们以这种方式显示.
我希望垂直显示.
解决方法:
您可以使用此处提到的分隔符选项:http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#activeCheckboxList()-detail
您的电话将如下所示:
<?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") ?>
或者您想在特定情况下用作分隔符的任何内容.
希望有帮助……
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。