@@ -232,6 +232,7 @@ your controller::
232
232
$form->handleRequest($request);
233
233
234
234
if ($form->isSubmitted() && $form->isValid()) {
235
+ // the $task object will now contain the submitted data!
235
236
// ... perform some action, such as saving the task to the database
236
237
237
238
return $this->redirectToRoute('task_success');
@@ -257,7 +258,7 @@ your controller::
257
258
This controller follows a common pattern for handling forms, and has three
258
259
possible paths:
259
260
260
- #. When initially loading the page in a browser, the form is simply created and
261
+ #. When initially loading the page in a browser, the form is created and
261
262
rendered. :method: `Symfony\\ Component\\ Form\\ FormInterface::handleRequest `
262
263
recognizes that the form was not submitted and does nothing.
263
264
:method: `Symfony\\ Component\\ Form\\ FormInterface::isSubmitted ` returns ``false ``
@@ -268,7 +269,7 @@ possible paths:
268
269
``task `` and ``dueDate `` properties of the ``$task `` object. Then this object
269
270
is validated. If it is invalid (validation is covered in the next section),
270
271
:method: `Symfony\\ Component\\ Form\\ FormInterface::isValid ` returns
271
- ``false ``, so the form is rendered together with all validation errors;
272
+ ``false `` and the form is rendered again, but now with validation errors;
272
273
273
274
#. When the user submits the form with valid data, the submitted data is again
274
275
written into the form, but this time :method: `Symfony\\ Component\\ Form\\ FormInterface::isValid `
@@ -286,7 +287,7 @@ possible paths:
286
287
287
288
If you need more control over exactly when your form is submitted or which
288
289
data is passed to it, you can use the :method: `Symfony\\ Component\\ Form\\ FormInterface::submit `
289
- for this . Read more about it :ref: `in the cookbook <cookbook-form-call-submit-directly >`.
290
+ method . Read more about it :ref: `in the cookbook <cookbook-form-call-submit-directly >`.
290
291
291
292
.. index ::
292
293
single: Forms; Validation
@@ -388,11 +389,14 @@ object.
388
389
That's it! If you re-submit the form with invalid data, you'll see the
389
390
corresponding errors printed out with the form.
390
391
392
+ Validation is a very powerful feature of Symfony and has its own
393
+ :doc: `dedicated chapter </book/validation >`.
394
+
391
395
.. _book-forms-html5-validation-disable :
392
396
393
397
.. sidebar :: HTML5 Validation
394
398
395
- As of HTML5, many browsers can natively enforce certain validation constraints
399
+ Thanks to HTML5, many browsers can natively enforce certain validation constraints
396
400
on the client side. The most common validation is activated by rendering
397
401
a ``required `` attribute on fields that are required. For browsers that
398
402
support HTML5, this will result in a native browser message being displayed
@@ -420,9 +424,6 @@ corresponding errors printed out with the form.
420
424
'attr' => array('novalidate' => 'novalidate'),
421
425
)) ?>
422
426
423
- Validation is a very powerful feature of Symfony and has its own
424
- :doc: `dedicated chapter </validation >`.
425
-
426
427
.. index ::
427
428
single: Forms; Built-in field types
428
429
0 commit comments