Using YII, I generate a list of checkboxes. The problem is that the last checkbox actually works like "select all" although it should not. It seems that this is a finch of the framework itself. How to deal with these?

<?php foreach ($users as $key => $user) { print "<tr><td>"; print $user->fullname . "</td><td>"; print CHtml::activeHiddenField($Form, 'userId', array('value' => $user->id)); if (in_array($user->id, $usersId)) { print CHtml::activeCheckBox($form, "responsibility", array('checked' => TRUE)); } else { print CHtml::activeCheckBox($form, "responsibility"); } print "</td></tr>"; } ?> 

    1 answer 1

    Hmm bike some.

    Isn't it easier to take a component and display the necessary checkboxes?

     $form->checkBoxList($model, 'categories',users::model()->findAll());