I\'m writing my own CAPTCHA class and when the form doesn\'t validate, I don\'t want to pre-populate the captcha input with the previous answer, for obvious reasons. I just want
You can pass an incomplete entity to the action called when your control finds form invalid.
public function updateAction(Request $request, $id) { $entity = $this->EM()->getRepository('Bundle:Entity')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Entity entity.'); } $form = $this->createForm(new RecommendationType() ,$entity ,array( 'attr' => array( ,'entity' => $entity ) ) ); $form->bind($request); if ($form->isValid()) { $this->EM()->persist($entity); $this->EM()->flush(); return $this->redirect($this->generateUrl('entity_show' ,array('id' => $id))); } else { $entity->setCapthca(Null); } return $this->render('Bundle:Entity:edit.html.twig' ,array( 'entity' => $entity ,'form' => $form->createView() ) ); }
The create action would have similar modification.