title: Add form fields based on form choice
body: <p>I need to dynamically add fields to a form based on user input. Let's suppose that I have an entity A with subentities B and C. Initially the form has a choice field where the user can select the type, B or C. If the user select B the fields B.x and B.y should be added to the form, and if the user select C the fields C.x, C.y and C.z should be added instead.</p>
  
  <p>Can I do this using PHP/Symfony, or do I need to use JavaScript to show/hide fields? I was reading the <a href="http://symfony.com/doc/current/cookbook/form/dynamic_form_modification.html" rel="nofollow">Dynamic Form Modification</a> tutorial on Symfony but I still couldn't figure out how to do this.</p>