title: How change return render direction in Symfony2
body: <p>I Have a problem rendering a form in symfony.</p>
  
  <p>I use a comercial template (SmartAdmin) and this template use AJAX to capture all the urls loaded, keep the menus and configuration when the url provide '#'</p>
  
  <p>Normally i can work ok, but in this controller i have a problem when the validation fails</p>
  
  <pre><code>public function createAction(Request $request)
      {
          $entity = new Clientes();
          $form = $this-&gt;createCreateForm($entity);
          $form-&gt;handleRequest($request);
  
          if ($form-&gt;isValid()) {
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $em-&gt;persist($entity);
              $em-&gt;flush();
  
              $url=$this-&gt;generateUrl('ec_main_cliente', array('idcliente' =&gt; $entity-&gt;getId()));
              $url = str_replace('cliente', '#cliente', $url);
  
              return $this-&gt;redirect($url);
          }
  
  
  
          return $this-&gt;render('ECMainBundle:Clientes:nuevo_cliente.html.twig', array(
                  'entity' =&gt; $entity,
                  'form'   =&gt; $form-&gt;createView(),
              ));
      }
  </code></pre>
  
  <p>When Form is Invalid , load "ECMainBundle:Clientes:nuevo_cliente.html.twig" without the "#" and lost all the menus and configurations.</p>
  
  <p>Any suggestion please?</p>
  
  <p>Thanks in Advance and sorry for my english</p>
  
  <p>Image work Ok:
  <img src="https://i.stack.imgur.com/kf6LV.png" alt="enter image description here"></p>
  
  <p>Image of the problem:
  <img src="https://i.stack.imgur.com/ZABGT.png" alt="Image of the problem"></p>