@@ -400,8 +400,8 @@ the data that was submitted by the user. For example, imagine you have a registr
400
400
form for sports gatherings. Some events will allow you to specify your preferred
401
401
position on the field. This would be a ``choice `` field for example. However the
402
402
possible choices will depend on each sport. Football will have attack, defense,
403
- goalkeeper etc... Baseball will have a pitcher but will not have goalkeeper. You
404
- will need the correct options to be set in order for validation to pass.
403
+ goalkeeper etc... Baseball will have a pitcher but will not have a goalkeeper. You
404
+ will need the correct options in order for validation to pass.
405
405
406
406
The meetup is passed as an entity field to the form. So we can access each
407
407
sport like this::
@@ -455,11 +455,13 @@ On a form, we can usually listen to the following events:
455
455
456
456
.. versionadded :: 2.2.6
457
457
458
+ The behavior of the ``POST_BIND `` changed slightly in 2.2.6, which the
459
+ below example uses.
458
460
459
- The key is to add a ``POST_BIND `` listener to the field your new field is dependent
460
- on. If you add a POST_BIND listener to a form child, and add new children to the parent
461
- from there , the Form component will detect the new field automatically and maps it
462
- to the client data if it is available .
461
+ The key is to add a ``POST_BIND `` listener to the field that your new field
462
+ depends on. If you add a `` POST_BIND `` listener to a form child (e.g. `` sport`),
463
+ and add new children to the parent form , the Form component will detect the
464
+ new field automatically and map it to the submitted client data .
463
465
464
466
The type would now look like::
465
467
@@ -496,7 +498,7 @@ The type would now look like::
496
498
}
497
499
);
498
500
499
- $builder->get('meetup ')->addEventListener(
501
+ $builder->get('sport ')->addEventListener(
500
502
FormEvents::POST_BIND,
501
503
function(FormEvent $event) use ($formModifier) {
502
504
// It's important here to fetch $event->getForm()->getData(), as
0 commit comments