title: Symfony check form field exist inside controller
body: <p>Is there a way to check if a form field exist inside a controller?</p>
  
  <p>I have a few submit buttons but depending on the data in the object the associated one will be shown and created.</p>
  
  <p>FormType.php</p>
  
  <pre><code>$builder-&gt;addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) {
      /** @var ObjectInfo $tab */
      $tab = $event-&gt;getData();
      $form = $event-&gt;getForm();
  
      if (some condition) {
          //No Value has been set or NULL
          $form-&gt;add('submit_second', 'submit', array(
              'label' =&gt; 'submit',
          ))
      }
  </code></pre>
  
  <p>controller.php</p>
  
  <pre><code> if ($overviewForm-&gt;get('submit_second')-&gt;isClicked()) {
       // do something
   }
  </code></pre>
  
  <p>I have also tried </p>
  
  <pre><code>if (
      !is_null($overviewForm-&gt;get('submit_second')) &amp;&amp; 
      $overviewForm-&gt;get('submit_second')-&gt;isClicked()
  ) {
  </code></pre>
  
  <p>on submit I get</p>
  
  <p>Error</p>
  
  <pre><code>Child "submit_second" does not exist.
  </code></pre>