have three tables - photos, categories, photos_categories - MANY_MANY rela
now i want in form for creating photo entrys, have list of categories, and select more than one.
so i have this in photos/_form
$cats=categories::model()->findAll(); echo CHtml::activeListBox($model, 'categories', CHtml::listData($cats, 'id', 'categoryName'), array('empty' => '--Select a category--', 'multiple'=>'multiple')); ?>
which works fine, i create the post, using CAdvancedArBehavior - it writes relation to photos_categories table.
but, when i want to update the post, the listbox in update form doesnt select the propper items that are stored, as if it did not accepted ‘categories’ as selected list… if i look after what comes to update in $model->categories - its array of categories objects.
anyone can help me with that? i tryed to look after some MANY-MANY example, with form, but found none.