Skip to content

[Form] Event form modification improvements #9254

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions form/dynamic_form_modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,11 @@ callbacks only because in two different scenarios, the data that you can use is
available in different events. Other than that, the listeners always perform
exactly the same things on a given form.

.. tip::

The ``FormEvents::POST_SUBMIT`` event does not allow to modify the form
the listener is bound to, but it allows to modify its parent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand your comment, what can we add here exactly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just agree with your proposal! Let's add what you suggest :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although it supports the example, I fail to see the logic behind it. Why does it work that way? It looks like a loophole (failure to verify that a form field is added when it's made from a children) that is used in a very common example.

One piece that is still missing is the client-side updating of your form after
the sport is selected. This should be handled by making an AJAX call back to
your application. Assume that you have a sport meetup creation controller::
Expand Down
3 changes: 2 additions & 1 deletion form/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ View data Normalized data transformed using a view transformer

.. caution::

At this point, you cannot add or remove fields to the form.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I just make explicit that child fields cannot be changed on POST_SUBMIT, is that wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, misread the changes. This is correct.

At this point, you cannot add or remove fields to the current form and its
children.

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

Expand Down