diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index b963bab1e5d..2add7ddd759 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -116,7 +116,7 @@ the event listener might look like the following:: public function buildForm(FormBuilderInterface $builder, array $options) { // ... - $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event){ + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { $product = $event->getData(); $form = $event->getForm(); @@ -147,7 +147,8 @@ the event listener might look like the following:: $builder->addEventListener(FormEvents::PRE_SET_DATA, array($this, 'onPreSetData')); } - public function onPreSetData(FormEvent $event){ + public function onPreSetData(FormEvent $event) + { // ... } } @@ -253,7 +254,7 @@ Using an event listener, your form might look like this:: ->add('subject', 'text') ->add('body', 'textarea') ; - $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event){ + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { // ... add a choice list of friends of the current application user }); } @@ -653,7 +654,31 @@ field according to the current selection in the ``sport`` field: {# ... #} {{ form_end(form) }} - .. include:: /cookbook/form/dynamic_form_modification_ajax_js.rst.inc + .. code-block:: html+php @@ -664,7 +689,31 @@ field according to the current selection in the ``sport`` field: end($form) ?> - .. include:: /cookbook/form/dynamic_form_modification_ajax_js.rst.inc + The major benefit of submitting the whole form to just extract the updated ``position`` field is that no additional server-side code is needed; all the diff --git a/cookbook/form/dynamic_form_modification_ajax_js.rst.inc b/cookbook/form/dynamic_form_modification_ajax_js.rst.inc deleted file mode 100644 index 09e255808db..00000000000 --- a/cookbook/form/dynamic_form_modification_ajax_js.rst.inc +++ /dev/null @@ -1,25 +0,0 @@ - \ No newline at end of file