I have a checkbox which is checking itself when it gets passed an object where the PK is 1,
Assume $posts is all the equipment in the table :
$posts= Equipment::model()->findAll();
<div class="checkboxes"><?php foreach ($posts as $equipment) {
?><div><?php
echo $form->checkBox($equipment, "[$equipment->equipment_id]equipment_id", array('autocomplete' => 'off'));
echo $form->labelEx($equipment,"[$equipment->equipment_id]".$equipment->equipment_name );
echo $form->error($equipment, 'equipment_name');
?></div><?php
} ?>
</div>
In my table I have
equipment_id, equipment_name
1 Hard Hat
2 Hat/ Hair Enclosure
3 Safety Glasses
When i render a blank form, it checks "hard hat" by default. I tried autocomplete off, but if i delete "Hard Hat" from the database then it is fine. But if the ID is 1, then it seems to be checking my tick box.