Reputation: 271
I need to create check box list content for Example departments and user can check multiple box.
With drowpdownlist I can load value like this :
model :
public function getsection(){
return array (
CHtml::listData(Csection::model()->findAll(),'section_id','ar_name'),
);
}
view :
echo CHtml::activedropDownList(
$models,
'section_id',
$models->getsection(),
array(
'size'=>'4',
'prompt'=>'أSelect Sections ',
'multiple' => 'multiple',
)
);
So how can I do that with checkboxlist, also how to process values in controller, is it like drowpdownlist ?
Upvotes: 2
Views: 338
Reputation: 2489
You can use Chtml::activeCheckBoxList
echo Chtml::activeCheckBoxList($models, 'section_id', $models->getsection());
Upvotes: 2