Modify Data Within Activecheckboxlist

I am still getting use to Yii, and came across another thing that’s kind of tricky, so any help is much appreciated.

I have a database with users and emails. Some users have multiple emails, so the format is something like:

Name1 | Email1;

Name2 | Email2;Email3

Name3 | Email4;

Name4 | Email5;

What I would like to do is display a checkbox for ALL emails found AND always remove the ;




$emails = CHtml::listData(Parties::model()->findAll(array("condition"=>"orgid = $clientid AND email != ''"), array()), 'id', 'email');

echo CHtml::activeCheckboxList(	$model, 'type', $emails	);



I see there is a separator parameter, but it doesn’t appear to be working, OR i am not doing it correctly.

Also, how can I do a find and replace, or str_replace to remove the ;


<?php

$parties = Parties::model()->findAll(array("condition"=>"LENGTH(email) > 0 AND orgid=:orgid", "params"=>[":orgid"=>$clientid]));

$emails = CHtml::listData($parties , 'id', function($party) {

	return preg_replace('/\;/', '', $party->email);

});

echo CHtml::activeCheckboxList( $model, 'type', $emails );

?>