Open
Description
Symfony version(s) affected
6.4.* / 7.*
Description
When a ChoiceType
field with 'expanded' => true
is submitted, all children are considered valid even if a selected value is invalid. Only the parent is considered invalid ('valid' => false
in the form view data).
How to reproduce
Create a form with the following field:
->add('choice_checkbox', ChoiceType::class, [
'choices' => [
'Foo' => 'foo',
'Bar' => 'bar',
'Baz' => 'baz',
],
'expanded' => true,
'multiple' => true,
'constraints' => new Assert\EqualTo('baz'),
])
Then select foo
and/or bar
and submit the form.
- Parent field is invalid (
'valid' => false
) - Children are valid (
'valid' => true
) whereasfoo
andbar
should be invalid ('valid' => false
)
Possible Solution
No response
Additional Context
No response