jeudi 7 mai 2015

Checkboxlist boxes won't appear checked on Update page

I have a checkboxlist on both create and update views:

<?php echo $form->field($model3, 'options[]')->checkboxList(['CPF' => 'CPF', 'FWL' => 'FWL', 'SDL' => 'SDL', 'CDAC' => 'CDAC']); ?>

Then I used this code to save the checkboxlist checked boxes as strings:

$model3->options = implode(',',  $model3->options);

Upon updating, I used this code to convert it back to an array:

$model3->options = explode(",", $model3->options);

I expect that there should be checked boxes in my update page based on what's checked upon creation. But the checkboxlist boxes remain unchecked.

How do I display these checked boxes on my update page?




Aucun commentaire:

Enregistrer un commentaire