mardi 7 juillet 2015

set default data for symfony choice field with multiple set to true

I am trying to render a choice field with checkboxes and I want, in edit mode, this to have the data the user previously checked meaning a way to set default data. the below code does not work. can someone help please. thank you

$days = array("monday" => "monday","tuesday" => "tuesday");
$builder->add('channels', 'choice', array(
            'choices' => array(
                'days'  => $days,                
            ),
            'multiple' => true,
            'expanded' => true,
            'required' => true,
            'data' => array("choices" => array("days" => array("monday")))
        ));




Aucun commentaire:

Enregistrer un commentaire