I’ve a code for checkbox list.
echo CHtml::activeCheckBoxList(PropertyFeaturesAmenities::model(), "amenities", CHtml::listData(Amenities::model()->findAll(), 'id', 'amenities'),array('class'=>'checkboxList'));
and it displays like this
4799
![checkboxlist.png](https://www.forum.yiiframework.com/ipb_uploads/monthly_10_2013/post-146503-045707400%201382098155.png)
and want to list it in three column like this…
4800
![checkboxlist2.png](https://www.forum.yiiframework.com/ipb_uploads/monthly_10_2013/post-146503-010148800%201382098349.png)
how to do this.
Hi,
You can use clistview to display only checkbox and provide pagination for every 10 checkboxes.
Thats all…
This is one way of handling multiple checkbox options
lima.kayo
(Lima Kayo)
4
try this
<div class="checkboxgroup">
<?php echo $form->checkBoxList($model, 'attribute', CHtml::listData(), array('template'=>'<div><label class="checkbox">{input}{label}</label></div>')); ?>
</div>
css
.checkboxgroup {
overflow:auto;
}
.checkboxgroup div {
width: 130px;
float:left;
}
Thanks man… I got it by doing some changes in your code.
<div class="checkboxgroup">
<?
echo CHtml::activeCheckBoxList($model, "attribute", CHtml::listData(),array('separator'=>' ','template'=>'<div>{input}{label}</div>'));
?>
</div>
CSS
.checkboxgroup {
overflow:auto;
}
.checkboxgroup div {
width: 230px;
float:left;
}