1

I'm new to Symfony so I need little help.

I have this code

    $form->handleRequest($request);

    if ($request->isMethod('POST')) {
        $form->submit($request);
        if ($form->isValid()) {
            //TODO
        }

        return $this->redirect($this->generateUrl('news'));
    }

When the form is submitted, I always obtain 500 Internal Server Error - AlreadySubmittedException.

2
  • Is this the full code of your controller? Commented Jul 31, 2013 at 19:46
  • No it isn't. It is part of the indexAction method. Commented Jul 31, 2013 at 19:49

1 Answer 1

3

You should use $form->handleRequest OR $form->submit, not both.

Sign up to request clarification or add additional context in comments.

1 Comment

How did I miss that :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.