Closed
Description
With Form version 2.7+
Imagine a situation of an expanded grouped choice field:
$choices = array(
'light' => array(
'blue' => 'lightblue',
'red' => 'lightred'),
'dark' => array(
'blue' => 'darkblue',
'red' => 'darkred')
);
$builder
->add('colors', 'choice', array(
'choices' => $choices,
'label' => false,
'expanded' => true,
'multiple' => true,
'choices_as_values' => true,
));
With some templating magic you can come up something like this (and so, there is a reason to use grouping with expanded choices)..
Now, the problem is that DefaultChoiceListFactory::flatten will merge the darkblue and lightblue into the same value key (both checkboxes will have the value="0") and upon postback the third checkbox value will be lightblue instead of the properly selected darkblue.
This concept works well with Symfony Form 2.6.
Metadata
Metadata
Assignees
Labels
No labels