File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -232,13 +232,21 @@ controller::
232232 $form->handleRequest($request);
233233
234234 if ($form->isValid()) {
235- // perform some action, such as saving the task to the database
235+ // ... perform some action, such as saving the task to the database
236236
237237 return $this->redirect($this->generateUrl('task_success'));
238238 }
239239
240- // ...
240+ return $this->render('default/new.html.twig', array(
241+ 'form' => $form->createView(),
242+ ));
241243 }
244+
245+ .. caution ::
246+
247+ Be aware that the ``createView() `` method should be called *after * ``handleRequest ``
248+ is called. Otherwise, changes done in the ``*_SUBMIT `` events aren't applied to the
249+ view (like validation errors).
242250
243251.. versionadded :: 2.3
244252 The :method: `Symfony\\ Component\\ Form\\ FormInterface::handleRequest ` method
You can’t perform that action at this time.
0 commit comments