Skip to content

Commit 1a90234

Browse files
committed
minor #9254 [Form] Event form modification improvements (julienfalque)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] Event form modification improvements * `FormEvents::SUBMIT` *does* allow to modify the form (tested on Symfony 3.3 but looking at the code, this seems to be true for 2.7 as well); * `FormEvents::POST_SUBMIT` allows to modify the parent form, this was not explicit in the documentation so I thought it would be a nice addition. Commits ------- d40285b Event form modifications improvements
2 parents 3929eca + d40285b commit 1a90234

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

form/dynamic_form_modification.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,11 @@ callbacks only because in two different scenarios, the data that you can use is
591591
available in different events. Other than that, the listeners always perform
592592
exactly the same things on a given form.
593593

594+
.. tip::
595+
596+
The ``FormEvents::POST_SUBMIT`` event does not allow to modify the form
597+
the listener is bound to, but it allows to modify its parent.
598+
594599
One piece that is still missing is the client-side updating of your form after
595600
the sport is selected. This should be handled by making an AJAX call back to
596601
your application. Assume that you have a sport meetup creation controller::

form/events.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ View data Normalized data transformed using a view transformer
219219

220220
.. caution::
221221

222-
At this point, you cannot add or remove fields to the form.
222+
At this point, you cannot add or remove fields to the current form and its
223+
children.
223224

224225
.. sidebar:: ``FormEvents::POST_SUBMIT`` in the Form component
225226

0 commit comments

Comments
 (0)