ciurciurek ciurciurek - 4 months ago 47
Twig Question

Symfony 3 don't send the form

I'm creating blog in Symfony 3.1.7 and i have a problem with sending the form. I created comment Entity Class. Then I generated form class by console end edited buildForm method. It looks like:

public function buildForm(FormBuilderInterface $builder, array $options)

My controller looks like this

* @Route("/article/{id}", name="show_article")
public function showAction( Post $post, Request $request )
$comment = new Comment;
$comment -> setPost($post);
$form = $this->createForm(CommentType::class);

if ($form->isSubmitted() ) {
$em = $this->getDoctrine()->getManager();
return $this->render('default/show.html.twig',[
'post' => $post,
'form' => $form -> createView()

Form is displayed by twig helper

And the problem is when i try to send form. I clicked on button
and nothing is happening. It looks like form was never subbmited.

Thanks for your help.


Use SubmitType like so: