I have a little problem with Symfony2 and Javascript.
I have a form with a select box:
$builder
->add('town', 'entity', [
'class' => 'AppBundle:Towns',
'property' => 'id',
'placeholder' => 'Select an item',
'required' => true,
]);
When I click on a town, the taxes associated to the selected town must be displayed in the form, as check boxes.
For what I understand, I must call to a controller via AJAX and get a JSON of the id's and the descriptions of the taxes, isn't it? But then what should I do to add this information to the form? And how can I intercept the "selected" event of this selectbox?
And should I do anything to send the information to the server, when a user click on the "Send" button? AFAIK, Symfony2 has some mechanisms to avoid sending data not generated by the form, isn't it?