In my base twig file I'm rendering my footer. In the footer these is an registration form for subscripting to the newsletter. This is de render call in the base twig.
{{ render(controller('MyBundle:Global:footer')) }}
Via this footer controller I'm rendering the footer. Hereby the controller code:
/**
* @Route("/{_locale}/newsletter/", defaults={"_locale": "nl"}, requirements={"_locale": "nl|en|de"}, name="_newsletter")
*/
public function footerAction(Request $request)
{
$form = $this->createForm(new NewsletterType());
$form->handleRequest($request);
if ($form->isValid()) {
return $this->redirectToRoute('_404');
} else {
return $this->render('MyBundle:global:footer.html.twig', array('form' => $form->createView()));
}
}
If I submit the form what only a email input is and an submit button then this route is triggered, only the form is not validated. In this example for test I want to redirect it to the 404 page. But it just reders the footer only?