我正在尝试在Yii网站的表单中使用activeCheckboxlist.生成复选框列表时,Yii会自动在复选框之间放置一个<br>.
有没有办法避免/覆盖这个除了CSS?
是的,你可以通过在htmlOptions中给出'separator'参数来做到这一点
echo CHtml::activeCheckboxList($model, $attribute, $dataArr,
array(
//..
'separator'=>'|', //new separator. html allowed also
//'template'=>'<span class="myItem">{label} {input}</span>', // use template to customize each item
//..
));
Run Code Online (Sandbox Code Playgroud)
http://www.yiiframework.com/doc/api/1.1/CHtml#activeCheckBoxList-detail