title: Add a dynamic form field after pressing a button
body: <p>I have a form with a simple button <code>$builder-&gt;add('language_switcher', ButtonType::class);</code> which should simply, if pressed, add another field. To do that, I used Symfony's cookbook <a href="http://symfony.com/doc/current/form/dynamic_form_modification.html" rel="nofollow">http://symfony.com/doc/current/form/dynamic_form_modification.html</a> </p>
  
  <pre><code>$builder
      -&gt;get('language_switcher')
      -&gt;addEventListener(
          FormEvents::POST_SUBMIT,
          function () use ($builder, $options) {
              $preparedOptions = $this-&gt;prepareOptions($options['data']['productCustomizations']);
              $builder-&gt;add('lang_switcher'), ChoiceType::class, $preparedOptions);
  
          }
      );
  </code></pre>
  
  <p>When now submitting it via AJAX</p>
  
  <pre><code>&lt;script&gt;
      var $button = $('#xyz');
  
      $button.click(function() {
          var $form = $(this).closest('form');
          $.ajax({
              url: $form.attr('action'),
              type: $form.attr('method'),
              success: function(html) {
                  console.log(html);
                  $('#xyz').replaceWith($(html).find('#lang_switcher'));
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm getting the error <code>Buttons do not support event listeners.</code> So I tried it out with a hidden field. I added the hidden field to the Form, set the <code>EventListener</code> to it, and added this <code>data</code> to my <code>AJAX</code> request</p>
  
  <p><code>data[$('#id_of_hidden_field').attr('name')] = 1;</code></p>
  
  <p>However this did nothing. The example in the cockbook is after submitting a choice field so I don't know how to adapt it to my needs. I couldn't use a <code>SubmitType</code>, because then it would submit the form, right? I just want to have it with a simple button.</p>
  
  <p>The problem is, that, when I do a <code>console.log(html)</code> I don't see the new html element, so it seems like I'm not getting to the <code>EventListener</code> which is weird, because if I dump contents inside the listener I'm getting some data. It just seems like I'm not getting it inside the response</p>