Skip to content

Commit 68d0ee2

Browse files
committed
Corrected docs according to WouterJ comments
1 parent 4620e26 commit 68d0ee2

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

book/forms.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ these cases you can set the ``validation_groups`` option to ``false``::
495495

496496
Note that when you do that, the form will still run basic integrity checks,
497497
for example whether an uploaded file was too large or whether non-existing
498-
fields were submitted. If you want to surppress validation you can use
499-
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-supressing-form-validation>`
498+
fields were submitted. If you want to suppress validation, you can use the
499+
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-suppressing-form-validation>`
500500

501501
.. index::
502502
single: Forms; Validation groups based on submitted data

cookbook/form/dynamic_form_modification.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -536,19 +536,18 @@ back to your application. In that controller, you can submit your form, but
536536
instead of processing it, simply use the submitted form to render the updated
537537
fields. The response from the AJAX call can then be used to update the view.
538538

539-
.. _cookbook-dynamic-form-modification-supressing-form-validation:
539+
.. _cookbook-dynamic-form-modification-suppressing-form-validation:
540540

541-
Supressing Form Validation
541+
Suppressing Form Validation
542542
---------------------------
543543

544-
One way you can use ``POST_SUBMIT`` event is to completely supress
545-
form validation. The reason for that is even if you set ``group_validation``
546-
to ``false`` there still some integrity check are run, for example whether
547-
an uploaded file was too large or whether non-existing fields were submitted.
544+
To suppress form validation you can use the ``POST_SUBMIT`` event and prevent
545+
:class:`Symfony\\Component\\Form\\Extension\\Validator\\EventListener\\ValidationListener`
546+
invocation.
548547

549-
If you want to suppress even that, you should use ``POST_SUBMIT`` event to prevent
550-
:class:`Symfony\\Component\\Form\\Extension\\Validator\\EventListener\\ValidationListener`
551-
invocation::
548+
The reason for this is even if you set ``group_validation`` to ``false`` there
549+
are still some integrity checks executed, for example whether an uploaded file
550+
was too large or whether non-existing fields were submitted::
552551

553552
use Symfony\Component\Form\FormBuilderInterface;
554553
use Symfony\Component\Form\FormEvents;
@@ -557,11 +556,12 @@ invocation::
557556
{
558557
$builder->addEventListener(FormEvents::POST_SUBMIT, function($event) {
559558
$event->stopPropagation();
560-
}, /* priority higher than ValidationListener */ 200);
559+
}, /* priority higher than ValidationListener */ 900);
561560

562561
// ...
563562
}
564563

565-
Note that that by doing that you can disable something more than form validation,
566-
because ``POST_SUBMIT`` event can be used for something else.
567-
You also have to know what would be the right priority for disabling POST_SUBMIT events.
564+
.. caution::
565+
566+
By doing this, you can disable something more than just form validation,
567+
because ``POST_SUBMIT`` event can be used for something else.

0 commit comments

Comments
 (0)