-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Modifications needed to form events chapter #2464
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
Comments
@weaverryan +10 http://symfony.com/doc/current/cookbook/form/dynamic_form_modification.html "One piece that may still be 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. In that controller, you can submit your form, but instead of processing it, simply use the submitted form to render the updated fields. The response from the AJAX call can then be used to update the view." How is this done? A full example of how to handle the AJAX call to the application/controller and how to use the submitted form to render the updated fields/form would be very usefull. also "acme.form.meetup_registration_listener" is missing a : at the end. |
…bicpi) This PR was merged into the 2.3 branch. Discussion ---------- [Cookbook][Dynamic Form Modification] Add AJAX sample | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3+ | Fixed tickets | #2464 ("AJAX experience") Do we need a PHP version of the `create.html.twig` which would mainly contain redundant JavaScript? Commits ------- a75ad9c Shorten AJAX example ee33dcd Remove some empty lines from code samples f47a7c3 Updates & Fixes after public review 2533f29 [Cookbook][Dynamic Form Modification] Add AJAX sample
Hi, i just struggled a bit with form events and dynamic fields. I was adding fields in the SUBMIT event and even if the field was validated the error was not added to the form. Just moving from SUBMIT to PRE_SUBMIT did the trick. The requirement for PRE_SUBMIT if your field has constraints could be documented Thank you |
Thank you for this issue. |
Friendly ping? Should this still be open? I will close if I don't hear anything. |
For a while already, we have an article dedicated to all events: https://symfony.com/doc/current/form/events.html That fixes the biggest points in this issue, so let's close here. (updating to more real examples is something that applies to many articles, there is no need for an open issue for that imho) |
The form events chapter just underwent a big addition and facelift in #1842 and #2417. But, it's still not quite right. Here are the needed changes:
The text was updated successfully, but these errors were encountered: