I use a single form to create and update the form. I need to check the default box in the following form
<div class="row" style='float:left;;margin-left:5px'> <?php echo '<span for="label" style="margin-bottom:5px;font-size: 0.9em;font-weight: bold;">Label</span><br />'; ?> <?php echo $form->checkBox($model,'label_name',array('value'=>1,'uncheckValue'=>0,'checked'=>'checked','style'=>'margin-top:7px;')); ?> <?php echo $form->error($model,'label_name'); ?> </div>
I use the code above to achieve the same goal. I am not getting the result as expected. When updating the form, it displays a check box, even if it is not selected.
source share