Modifications needed to form events chapter #2464

Open
weaverryan opened this Issue Apr 4, 2013 · 1 comment

Comments

Projects
None yet
2 participants
Member

weaverryan commented Apr 4, 2013

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:

  • Simplify the first example - a subscriber is overkill, a listener is easier, and a callback is probably the best approach
  • We need to document every form event and its purpose, what its data is, etc
  • Both the FriendMessage and SportsMeetup examples aren't really completed. They leave out more detail than I like and so aren't copy-and-pastable. This is especially true of SportsMeetup, where I ran out of steam to keep going :). Ideally, all three examples would be more consistent - building up on the same example, not three different examples.
  • I think we need to spend some time on the AJAX experience that's so common when you have one form field that depends on another (i.e. user selects "Country", AJAX request is made to update the "State" field).

peshi commented Aug 7, 2013

@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.

@weaverryan weaverryan added a commit that referenced this issue Mar 18, 2014

@weaverryan weaverryan feature #3411 [Cookbook][Dynamic Form Modification] Add AJAX sample (…
…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
a1050eb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment