Hello i need a help printing a list of checkboxes divided by groups.
I got a model that corresponds to Project, and every project may have properties and that properties are divided by categories.
I got this relations:
Project model:
‘properties’ => array(self::MANY_MANY, ‘Property’, ‘project_property(id_project, id_property)’),
Property model:
‘projects’ => array(self::MANY_MANY, ‘Project’, ‘project_property(id_project, id_property)’),
‘idCategory0’ => array(self::BELONGS_TO, ‘Category’, ‘id_category’),
Category model:
‘properties’ => array(self::HAS_MANY, ‘Property’, ‘id_category’),
I’m using this code on my Project _form (create/update) view:
echo CHtml::activeCheckboxList(
$model, 'properties',
CHtml::listData(Property::model()->findAll(), 'id_property', 'name'),
array('template'=>'{input} {label}','object'=>'id_property')
);
and it works nice but it prints like this:
[] HTML
[] CSS
[] PHP
[] JAVA
[] C++
But i need checkboxes divided in categories like this:
I want to display this:
Webdesign:
[] HTML
[] CSS
Programming Languages:
[] PHP
[] JAVA
[] C++
Please help me… thanks.