I'm doing a filter form in symfony2 and I try to preselect some filds.
I got two choices:
$formBuilder->add('first', 'choice',
array('choices' => $choiceFirst,
'expanded' => false,
'multiple' => true,
'data' => explode(' ', $this->getRequest()->get('first'))
));
$formBuilder->add('second', 'choice',
array('choices' => $choiceSecond,
'expanded' => true,
'multiple' => true,
'data' => explode(' ', $this->getRequest()->get('second'))));
For the first choice which is not expanded the datas pass by url are preselect. But not for the second which is expanded.
There is any ways to preselect checkboxs from a field choice?