@@ -447,7 +447,7 @@ The type would now look like::
447
447
class SportMeetupType extends AbstractType
448
448
{
449
449
public function buildForm(FormBuilderInterface $builder, array $options): void
450
- {
450
+ {
451
451
$builder
452
452
->add('sport', EntityType::class, [
453
453
'class' => Sport::class,
@@ -488,7 +488,7 @@ The type would now look like::
488
488
}
489
489
);
490
490
491
- // by default, action does not appear in the form tag
491
+ // by default, action does not appear in the < form> tag
492
492
// you can set this value by passing the controller route
493
493
$builder->setAction($options['action']);
494
494
}
@@ -546,7 +546,7 @@ field according to the current selection in the ``sport`` field:
546
546
.. code-block :: html+twig
547
547
548
548
{# templates/meetup/create.html.twig #}
549
- {{ form_start(form, { ' attr' : { 'id' : 'supply_history_form' } }) }}
549
+ {{ form_start(form, { attr: { id : 'supply_history_form' } }) }}
550
550
{{ form_row(form.sport) }} {# <select id="meetup_sport" ... #}
551
551
{{ form_row(form.position) }} {# <select id="meetup_position" ... #}
552
552
{# ... #}
@@ -568,19 +568,22 @@ field according to the current selection in the ``sport`` field:
568
568
});
569
569
570
570
const text = await req.text();
571
+
571
572
return text;
572
573
};
573
574
574
575
const parseTextToHtml = (text) => {
575
576
const parser = new DOMParser();
576
577
const html = parser.parseFromString(text, 'text/html');
578
+
577
579
return html;
578
580
};
579
581
580
582
const changeOptions = async (e) => {
581
583
const requestBody = e.target.getAttribute('name') + '=' + e.target.value;
582
584
const updateFormResponse = await updateForm(requestBody, form.getAttribute('action'), form.getAttribute('method'));
583
585
const html = parseTextToHtml(updateFormResponse);
586
+
584
587
const new_form_select_position = html.getElementById('meetup_position');
585
588
form_select_position.innerHTML = new_form_select_position.innerHTML;
586
589
};
0 commit comments