I'm working on Symfony 3.4 and I have a FormType with multiples fields and 2 booleans like :
->add("is_my_first_boolean", ChoiceType::class, array(
"expanded" => true,
"multiple" => false,
"choices" => array(
'Yes' => "1",
'No' => "0"
)
))
->add("is_my_second_boolean", ChoiceType::class, array(
"expanded" => true,
"multiple" => false,
"choices" => array(
'Yes' => "1",
'No' => "0"
)
))
So the user can select 2 booleans Yes/No on my form, and what I need is a validation (PHP validation in back-end, not in front) like at least one of these two booleans is selected.
So if both are set to NO, there is an error 'You must choose at least first_boolean or second_boolean"
What's the best way to do that ?
Thanks !