My problem here is different than other problems addresses in other questions. My problem is that the active field value is taken from another model than the creation model. It looks like the following:
...
foreach ($section->cavities as $cavity) {
$tr[$i] .= '<td>'.$form->field($cavityJob[$j], "[$j]cavity_id")->checkbox(['value' => $cavity->id, 'label' => $cavity->title.$section->title]).'</td>';
$i++;
$j++;
}
...
Notice here there are two models:
$cavityJob: the creation of field model$cavity: which supply the value of the field through itsidproperty
On create action I got the checkbox unchecked and I want them to be checked by default. I tried to place 'checked' => 'checked' in the options array of the field but it did not succeed in make checkbox checked by default.
Aucun commentaire:
Enregistrer un commentaire