I've a form with 2 dropdown lists. The first one with molecule families and the second with molecule subgroup. When someone choose a family, he should only see the subgroups related to this family in the second dropdown.
My Form Type:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('Families', ChoiceType::class, array(
'choices' => array(
'Monosaccharides' => 'Monosaccharides',
'Oligosaccharides ' => 'Oligosaccharides ',
'Polysaccharides' => 'Polysaccharides'
),
'placeholder' => 'Choose an option',
'required' => false
))
->add('MolecularGroups', ChoiceType::class, array(
'choices' => array(
'Monosaccharide' => 'Monosaccharide',
'Oligosaccharide' => 'Oligosaccharide',
'Cyanogenic glycoside' => 'Cyanogenic glycoside'
),
'placeholder' => 'Choose an option',
'required' => false
));
}
Can someone show me the Symfony documentation about how to implement that?