I have an array that i want to convert to a checboxlist. i know i could sort $arr3
before i pass it into checBoxList()
but i was just wondering if Yii has a built in way to sort it vertically instead of horizontally?
$arr3 = array('1'=1, '2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6);
echo $form->checkBoxList($model,'lat', $arr3,
array(
'name'=>'distance',
'separator'=>'',
'template'=>'<span class="col-md-6 col-xs-12">{input} {label}</span>',
'uncheckValue'=>0
)
);
the current output looks like this
1 2
3 4
5 6
but i would like it to look like this
1 4
2 5
3 6
here is my HTML
<div class="col-md-6 col-xs-12">
<input id="distance_0" value="1 km" name="distance[]" type="checkbox"> <label for="distance_0">1 km</label>
</div>
<div class="col-md-6 col-xs-12">
<input id="distance_1" value="2 km" name="distance[]" type="checkbox"> <label for="distance_1">2 km</label>
</div>
<div class="col-md-6 col-xs-12">
<input id="distance_2" value="3 km" name="distance[]" type="checkbox">
<label for="distance_2">3 km</label>
</div>