Update CHtml::checkBoxList values

i have many to many database relationship "user" "traits"

when user edit his profile he get CHtml::checkBoxList with list of traits on save data will store in a third table with "user_id" "trait_id"

i find how to create record and save data

but im really don’t know how update this value and retrieve data get the selected item checked in the CHtml::checkBoxList

thanks in advance

public static string checkBoxList(string $name, mixed $select, array $data, array $htmlOptions=array ( ))

maybe you can do this

<?php $data = CHtml::listData(Traits::model()->findAll(), 'trait_id', 'name');


		echo CHtml::checkBoxList('trait_id', $select, $data); ?>

$select is array trait_id data in your db from the third table with condition user_id that you want to update…

sorry for my poor english…

just want to help…

thanks for your help " Appropriated"

still a small question

On the create i sending to the view and it works

$coachstrength = new Coachstrength;

Coachstrength is where I’m storing my data

but on the edit im getting an error sending the retreive data

im using


but im getting an error while im sending data to the edit

u can try this

Coachstrength::model()->findAll(array('condition'=>'id = '.$id))

parameter for findAll u can check here