dongle7637 2015-04-20 09:42
浏览 147

如何使用ActiveForm-> checkboxList模板

I'm looking to use a template for my checkboxList. I'm using templates on other ActiveForm fields but it doesn't seem to work on checkboxList field.

I just need to get the input set to col-sm-7 instead of 6.

<?= $form->field($model, 'days', [
            'template' => "<div class='col-sm-3'>{label}</div><div class='col-sm-7'>
{input}</div>
{hint}
{error}"])
             ->inline()
             ->checkboxList(Onlinestore::$days, []) ?>
</div>
  • 写回答

1条回答 默认 最新

  • dongyixun0634 2015-04-20 09:54
    关注

    There is no option checkboxTemplate in ActiveField. It should be template:

    <?= $form->field($model, 'days', ['template' => "<div class='col-sm-3'>{label}</div><div class='col-sm-7'>
    {input}</div>
    {hint}
    {error}"])
        ->inline()
        ->checkboxList(Onlinestore::$days, []) ?>
    
    评论

报告相同问题?