I want to make forms which has three scenes
1.input view (which has 'confirm' button) 2.draft check view (which has 'send' button) 3.send view
in method 1 you can input the data then click 'confirm' button
the system write the data in DB as draft.
in method 2 you see the data and confirm then push 'send' button
the system write the flg 'confirmed'
these are my code.
it works well method 1 but if I push 'send' button in method2. it doesn't go.
if ($form->isValid()) {
My idea is something wrong??
public function writeEvalStudentAction(Request $request,$keyStr){
...
$form = $this->createFormBuilder($evalStudent)
->add('commentToStudent')
->add('confirm','submit')->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->has('send')){
if ($form->get('send')->isClicked()){
//set confirm flg then shows thanks screen.
$evalStudent->setConfirmed(true);
$em->persist($evalStudent);
$em->flush();
return $this->render('AcmeMemberBundle:Default:confirmedEvalStudent.html.twig');
}
}
if ($form->has('confirm')){
if ($form->get('confirm')->isClicked()){
// write in the db as draft.
$evalStudent->setCommentToStudent($form->get('commentToStudent')->getData());
$em->persist($evalStudent);
$em->flush();
$form = $this->createFormBuilder($evalStudent)->add('send','submit')->getForm();
return $this->render('AcmeMemberBundle:Default:checkEvalStudent.html.twig',
array('form' => $form->createView()));
}
}
return $this->render('AcmeMemberBundle:Default:writeEvalStudent.html.twig',
array('form' => $form->createView()));
}