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::
232
232
$form->handleRequest($request);
233
233
234
234
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
236
236
237
237
return $this->redirect($this->generateUrl('task_success'));
238
238
}
239
239
240
- // ...
240
+ return $this->render('default/new.html.twig', array(
241
+ 'form' => $form->createView(),
242
+ ));
241
243
}
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).
242
250
243
251
.. versionadded :: 2.3
244
252
The :method: `Symfony\\ Component\\ Form\\ FormInterface::handleRequest ` method
You can’t perform that action at this time.
0 commit comments