How To Create Two Column Of Checkbox List

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

and want to list it in three column like this…

4800

checkboxlist2.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

Hi,

May be this will be helpful for you

http://stackoverflow.com/questions/4136474/css-how-to-set-a-three-parallel-div

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;

}