Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] Introduce validation events#17229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Seb33300 wants to merge1 commit intosymfony:6.2
base:6.2
Choose a base branch
Loading
fromSeb33300:patch-2
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletionsform/events.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -228,6 +228,35 @@ View data Normalized data transformed using a view transformer
subscribes to the ``FormEvents::POST_SUBMIT`` event in order to
automatically validate the denormalized object.

3) Validating the Form (``ValidatorFormEvents::PRE_VALIDATE`` and ``ValidatorFormEvents::POST_VALIDATE``)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Form validation is triggered by the ``FormEvents::POST_SUBMIT`` event of the root form.
Two events are dispatched when Form validation is triggered:
``ValidatorFormEvents::PRE_VALIDATE``, ``ValidatorFormEvents::POST_VALIDATE``.

A) The ``ValidatorFormEvents::PRE_VALIDATE`` Event
..................................................

The ``ValidatorFormEvents::PRE_VALIDATE`` event is dispatched at the beginning of the
Form validation.

.. seealso::

See all form events at a glance in the
:ref:`Form Events Information Table <component-form-event-table>`.

B) The ``ValidatorFormEvents::POST_VALIDATE`` Event
...................................................

The ``ValidatorFormEvents::POST_VALIDATE`` event is dispatched after the
the entire form has been validated.

.. seealso::

See all form events at a glance in the
:ref:`Form Events Information Table <component-form-event-table>`.

Registering Event Listeners or Event Subscribers
------------------------------------------------

Expand All@@ -244,15 +273,17 @@ processed.

.. _component-form-event-table:

====================== ============================= ===============
Name ``FormEvents`` Constant Event's Data
====================== ============================= ===============
``form.pre_set_data`` ``FormEvents::PRE_SET_DATA`` Model data
``form.post_set_data`` ``FormEvents::POST_SET_DATA`` Model data
``form.pre_submit`` ``FormEvents::PRE_SUBMIT`` Request data
``form.submit`` ``FormEvents::SUBMIT`` Normalized data
``form.post_submit`` ``FormEvents::POST_SUBMIT`` View data
====================== ============================= ===============
====================== ====================================== ===============
Name ``FormEvents`` Constant Event's Data
====================== ====================================== ===============
``form.pre_set_data`` ``FormEvents::PRE_SET_DATA`` Model data
``form.post_set_data`` ``FormEvents::POST_SET_DATA`` Model data
``form.pre_submit`` ``FormEvents::PRE_SUBMIT`` Request data
``form.submit`` ``FormEvents::SUBMIT`` Normalized data
``form.post_submit`` ``FormEvents::POST_SUBMIT`` View data
``form.pre_validate`` ``ValidatorFormEvents::PRE_VALIDATE`` View data
``form.post_validate`` ``ValidatorFormEvents::POST_VALIDATE`` View data
====================== ====================================== ===============

Event Listeners
~~~~~~~~~~~~~~~
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp