From f041d70e925bf86355b92eaa1dde60f4e8478885 Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Thu, 20 Jul 2023 11:19:20 +0200 Subject: [PATCH] [Form] Fix form data related events definition --- form/events.rst | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/form/events.rst b/form/events.rst index 092be472012..37c3918d67d 100644 --- a/form/events.rst +++ b/form/events.rst @@ -48,10 +48,12 @@ A) The ``FormEvents::PRE_SET_DATA`` Event ......................................... The ``FormEvents::PRE_SET_DATA`` event is dispatched at the beginning of the -``Form::setData()`` method. It can be used to: - -* Modify the data given during pre-population; -* Modify a form depending on the pre-populated data (adding or removing fields dynamically). +``Form::setData()`` method. It is used to modify the data given during +pre-population with +:method:`FormEvent::setData() `. +The method :method:`Form::setData() ` +is locked since the event is dispatched from it and will throw an exception +if called from a listener. =============== ======== Data Type Value @@ -66,13 +68,6 @@ View data ``null`` See all form events at a glance in the :ref:`Form Events Information Table `. -.. caution:: - - During ``FormEvents::PRE_SET_DATA``, - :method:`Form::setData() ` - is locked and will throw an exception if used. If you wish to modify - data, you should use - :method:`FormEvent::setData() ` instead. .. sidebar:: ``FormEvents::PRE_SET_DATA`` in the Form component @@ -88,8 +83,8 @@ B) The ``FormEvents::POST_SET_DATA`` Event The ``FormEvents::POST_SET_DATA`` event is dispatched at the end of the :method:`Form::setData() ` -method. This event is mostly here for reading data after having pre-populated -the form. +method. This event can be used to modify a form depending on the populated data +(adding or removing fields dynamically). =============== ==================================================== Data Type Value