请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

如何使用activeform自定义样式

我再使用activeform来创建表单,但总有一些不需要代码出现

我如何使用activeform创建表单,只需要在指定的位置创建只有input标签

请老师提供代码,谢谢

<?php $form = ActiveForm::begin()?>
<div class="row">
    <div class="col-xs-12">
        <div class="box">

            <div class="box-body table-responsive no-padding">
                <table class="table table-hover">
                    <tr>
                        <th></th>
                        <th>序号</th>
                        <th>名称</th>
                        <th>登记人</th>
                        <th>登记时间</th>
                        <th>状态</th>

                    </tr>
                    <?php
                    $i = 1;
                    foreach ($list as $item ):
                    ?>
                    <tr>
                        <td><?=$form->field($model,'categoryid')->checkbox(['template'=>'<label>{input}</label>','class'=>'aaa'])->label('');?></td>
                        <td><?=$i;?></td>
                        <td><?=$item['title']?></td>
                        <td><?=$item['createuser']?></td>
                        <td><?=date('Y-m-d H:i:s',$item['createtime'])?></td>
                        <td>
                            <?php echo Yii::$app->params['status'][$item['status']];?>
                        </td>
                    </tr>

                    <?php
                    $i++;
                    endforeach;
                    ?>
                </table>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>
</div>
<?php ActiveForm::end();?>

但在页面中显示的时候会有

<div class="form-group field-category-categoryid">
<label>
<input type="hidden" value="0" name="Category[categoryid]">
<input id="category-categoryid" class="aaa" type="checkbox" value="1" name="Category[categoryid]">
</label>
</div>

我只想要

<input type="hidden" value="0" name="Category[categoryid]">
<input id="category-categoryid" class="aaa" type="checkbox" value="1" name="Category[categoryid]">

这样用activeform怎么实现

正在回答 回答被采纳积分+3

2回答

提问者 vijaychien 2016-09-08 22:48:42

唉,老师都不看的

0 回复 有任何疑惑可以回复我~
提问者 vijaychien 2016-08-29 15:28:31

在一个页面中,可能有多个不同样式的输入框,如何每个自定义

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信