How To Update Multiple Checkboxes In Another Model

Hi everybody and thanks for reading .

I have a Create form where i create meeting’s. Each meeting has some participants that are saved on bridge table.

This is the code i use on the Meetings controler to insert a new meeting and the participants to the meeting ;

public function actionCreate()


		$model=new Meeting;








                            //upload the partecipants

                                $partecipants = $_POST['Meeting']['partecipants'];    




                                foreach($partecipants as $partecipant){

                                        $bridge=new BridgeWg();













in the view i have the following code

 <?php echo $form->checkBoxListInlineRow($model, 'partecipants', CHtml::listData(UserRegistry::model()->findAll(), 'id_user_registry', 'firstname')); ?>

"partecipants" is a filed not present in the db so i defined it as public $participants in the model Meetings

Anybody has an idea how i can load the participants on the update page and have all the boxes checked of the participants i inserted during the creation of the Meeting.

Let me know if anybody has an idea or a link i could reffer to .

Thanks in advance

Dear Friend

Would you please check the following?

In your model override the afterFind method.


public function afterFind()



return parent::afterFind();


This will bring all the members id who attended the paricular meeting in array format.

This will nicely check the checkboxes during update.

Also put your bridge table name correctly in the code.


Thanks friend , i added the above code to my controler , whats next , do i have to add somethingh to the view (_form)?

Dear Friend

If you have added the $partecipants as virtual property to the model, that would be enough.

Now if we update the record, then checkboxes would be checked according to database values.