title: pre-selected items in CActiveForm->checkBoxList in Yii
body: <p>I have two arrays. One is <strong>$categories</strong> which contains all categories retrieved from my db and the other is <strong>$preSelectedCategories</strong> which contains the categories that needs to be pre-selected in my check box list when my form is loaded. I tried to do this:</p>
  
  <pre><code>&lt;?php echo $form-&gt;labelEx($model,'category_id'); ?&gt;
  &lt;?php echo $form-&gt;checkBoxList($model, 'category_id', $categories, $preSelectedCategories, array('multiple'=&gt;true)); ?&gt;
  &lt;?php echo $form-&gt;error($model,'category_id'); ?&gt;
  </code></pre>
  
  <p>But I did not succeed. Could anyone help me solve this problem? Thanks!</p>
  
  <p>Edit: I already knew that using <strong>CHtml::checkBoxList</strong> could help, but what I want here is to use <strong>CActiveForm::checkBoxList</strong> because I am using a model to validate the checkbox list.</p>