Answer the question
In order to leave comments, you need to log in
How to create selects with ajax loading in symfony?
Good afternoon.
There are 3 drop-down lists:
- country
- region
- city
There is a controller, there is a form. When choosing a country in the drop-down list, we send an ajax request, get a list of regions belonging to the country, update the drop-down list with a choice of regions, after choosing a region, load the list of cities.
The main problem is that in symphony, in the formtype for the drop-down list, you must specify choices, otherwise the form will not be valid when submitting. How to do it right? Please share an example.
Answer the question
In order to leave comments, you need to log in
This can be done via form events, here is an example from Cookbook symfony.com/doc/current/cookbook/form/dynamic_form...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question