Answer the question
In order to leave comments, you need to log in
How to bind selects in symfony?
Good evening.
There are several select forms (countries, region, city), tell me how to connect these selects with each other so that when choosing a country, there is a selection of the corresponding regions and cities.
P.Y. Thanks in advance.
formType
->add('city', EntityType::class, array(
'class' => 'AppBundle:Countries',
'choice_label' => 'name',
'expanded' => false,
'multiple' => false,
'label' => 'Выбрать страну',
'attr' => array(
'class' => 'form-control',
'style' => 'margin-bottom: 15px'
)
))
->add('city', EntityType::class, array(
'class' => 'AppBundle:Region',
'choice_label' => 'name',
'expanded' => false,
'multiple' => false,
'label' => 'Выбрать регион',
'attr' => array(
'class' => 'form-control',
'style' => 'margin-bottom: 15px'
)
))
->add('city', EntityType::class, array(
'class' => 'AppBundle:City',
'choice_label' => 'name',
'expanded' => false,
'multiple' => false,
'label' => 'Выбрать город',
'attr' => array(
'class' => 'form-control',
'style' => 'margin-bottom: 15px'
)
))
Answer the question
In order to leave comments, you need to log in
For example, using a dependent field from this bundle or analogues.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question