Adding a checkbox to checkboxlist

I have the following checkboxlist within my email form that customers choose all the communities they are interested in…




	<div class="row">

		<?php echo $form->labelEx($model,'communities').' (select all that apply)<br/>'; ?> 

		<?php echo $form->checkBoxList($model, 'communities', CHtml::listData(Community::model()->findAll($criteria), 'name', 'name')); ?>

	</div>



Everything works fine, but I would like to an additional checkbox to the list for Remodeling which is not in the Community table in the database. Is there a way to do this?

Thanks in advance for your help!

here is quick hack that will solve your problem


<?php

$options = Community::model()->findAll($criteria);

$newOption = new Community;

$newOption->name = "my custom record";

$options[] = $newOption;

?>


<?php echo $form->checkBoxList($model, 'communities', CHtml::listData($options, 'name', 'name')); ?>


// if you just need a blank option you do it like so

<?php echo $form->checkBoxList($model, 'communities', CHtml::listData($options, 'name', 'name'), array('prompt' => ' -- select one --')); ?>