title: Symfony2, call part of a form in an Ajax query
body: <p>I have a form in Symfony.</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('volume', IntegerType::class, array())
      ;
  
      $builder-&gt;add('product', ChoiceType::class, array(
          'data' =&gt; '1',
          'mapped' =&gt; false,
          'choices' =&gt; array(
                  '1' =&gt; 'One',
                  '2' =&gt; 'Two',
              ),
          )
      );
  
      $builder-&gt;add('deliveryType', ChoiceType::class, array(
          'expanded' =&gt; true,
          'data' =&gt; 1,
          'choices' =&gt; array(
              Command::STANDARD_DELIVERY =&gt; 'Standard',
              Command::EXPRESS_DELIVERY =&gt; 'Express',
          ),
      ));
  }
  </code></pre>
  
  <p>But the field <code>deliveryType</code> is loaded in another template called with an ajax request.
  But of corse I have this error:
  <code>Variable "form" does not exist in ... at line 26</code></p>
  
  <p>How can I put a part of a form in another template?</p>
  
  <p>Here is my main template:</p>
  
  <pre><code>&lt;div class="panel-body"&gt;
    {{ form_start(form)}}
    {{ form_errors(form) }}
  
    &lt;div class="row"&gt;
        &lt;div class="col-sm-12"&gt;
            {{ form_row(form.product) }}
            {{ form_row(form.volume, {'attr': {'class': 'form-control'}}) }}
            {{ form_row(form.town) }}
        &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div id="content-delivery-range"&gt;&lt;!-- Block loaded by ajax --&gt;&lt;/div&gt;
  
    &lt;br&gt;
    &lt;button type="submit" class="btn btn-primary btn-block"&gt;Continuer &lt;/button&gt;
  
    {{ form_end(form) }}
  
  &lt;/div&gt;
  </code></pre>
  
  <p>And now my template called with an Ajax request:</p>
  
  <pre><code>{{ deliveryRange|first|date('d M') }}
  {{ deliveryRange|last|date('d M') }}
  
  {% for d in deliveryRange %}
    {{ d|date('l') }} &lt;br&gt;
    &lt;small&gt;{{ d|intl_date('d') }} {{ d|date('M') }}&lt;/small&gt;
  {% endfor %}
  
  {{ form_row(form.deliveryType) }}
  </code></pre>