On rendering a form how to we get checkboxes that are true in the database to be checked?
I can set a checkbox using choice_attr, but I can't find a way of checking if the particular checkbox should be checked.
public function buildForm(FormBuilderInterface $builder, array $options)
'choice_attr' => function ($UserRoles, $key, $index) {
return ($key == 1) ? ['checked' => true] : ['checked' => false];
},
Aucun commentaire:
Enregistrer un commentaire