@@ -710,30 +710,5 @@ code from above to generate the submitted form can be reused.
710710Suppressing Form Validation
711711---------------------------
712712
713- To suppress form validation you can use the ``POST_SUBMIT `` event and prevent
714- the :class: `Symfony\\ Component\\ Form\\ Extension\\ Validator\\ EventListener\\ ValidationListener `
715- from being called.
716-
717- The reason for needing to do this is that even if you set ``validation_groups ``
718- to ``false `` there are still some integrity checks executed. For example
719- an uploaded file will still be checked to see if it is too large and the form
720- will still check to see if non-existing fields were submitted. To disable
721- all of this, use a listener::
722-
723- use Symfony\Component\Form\FormBuilderInterface;
724- use Symfony\Component\Form\FormEvents;
725- use Symfony\Component\Form\FormEvent;
726-
727- public function buildForm(FormBuilderInterface $builder, array $options)
728- {
729- $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
730- $event->stopPropagation();
731- }, 900); // Always set a higher priority than ValidationListener
732-
733- // ...
734- }
735-
736- .. caution ::
737-
738- By doing this, you may accidentally disable something more than just form
739- validation, since the ``POST_SUBMIT `` event may have other listeners.
713+ To suppress form validation, set ``validation_groups `` to ``false `` or an empty
714+ array.
0 commit comments