SYMFONY – Display an input according to the value of a drop-down list

  dynamic-forms, symfony, symfony-forms

I’m learning how to use Symfony and I’m stuck on a form.
I have a drop-down list, and depending on the choice, I would like to display an input.
I have been looking for a solution for more than 4 days, but I can’t find anything, so I come here to ask for your help

When I select "Lycéen.ne" in this dropdown list : dropdownList,
I would like to display the input "Lycée" : inputLycee

I know there are FormEvent, but I don’t really understand how it works and how to use JS to show or hide inputs

Thanks for your help =)

Source: Symfony Questions

LEAVE A COMMENT