@@ -536,19 +536,18 @@ back to your application. In that controller, you can submit your form, but
536
536
instead of processing it, simply use the submitted form to render the updated
537
537
fields. The response from the AJAX call can then be used to update the view.
538
538
539
- .. _cookbook-dynamic-form-modification-supressing -form-validation :
539
+ .. _cookbook-dynamic-form-modification-suppressing -form-validation :
540
540
541
- Supressing Form Validation
541
+ Suppressing Form Validation
542
542
---------------------------
543
543
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.
548
547
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 ::
552
551
553
552
use Symfony\Component\Form\FormBuilderInterface;
554
553
use Symfony\Component\Form\FormEvents;
@@ -557,11 +556,12 @@ invocation::
557
556
{
558
557
$builder->addEventListener(FormEvents::POST_SUBMIT, function($event) {
559
558
$event->stopPropagation();
560
- }, /* priority higher than ValidationListener */ 200 );
559
+ }, /* priority higher than ValidationListener */ 900 );
561
560
562
561
// ...
563
562
}
564
563
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