From f41492a73cb22fd76fa8c20240f0e7d40e6921dd Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 7 Dec 2015 15:40:32 +0100 Subject: [PATCH 1/2] Add isSubmitted call Streamline with http://symfony.com/doc/current/book/forms.html#handling-form-submissions Following best practice: http://symfony.com/doc/current/best_practices/forms.html --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index 384cc9cbd8e..d2099369899 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -242,7 +242,7 @@ controller:: $form->handleRequest($request); - if ($form->isValid()) { + if ($form->isValid() && $form->isSubmitted()) { // ... perform some action, such as saving the task to the database return $this->redirectToRoute('task_success'); From a864a996b883fec41bbdbc07eb6209c3364e0f18 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 7 Dec 2015 15:48:10 +0100 Subject: [PATCH 2/2] Update order of calls To follow best practice swap order of calls. --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index d2099369899..29235ee13b3 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -242,7 +242,7 @@ controller:: $form->handleRequest($request); - if ($form->isValid() && $form->isSubmitted()) { + if ($form->isSubmitted() && $form->isValid()) { // ... perform some action, such as saving the task to the database return $this->redirectToRoute('task_success');