Symfony – Form not redirecting to action specified in form

I’m trying to make a form, which I self-defined the action like this in my controller:

$form = $this->createForm(ProgrammeSearchType::class, $search, [
    'action' => $this->generateUrl('recherche_programme'),
    'method' => 'GET',
]);

But, the form rendered in the view look like this:

<form id="myForm">
{{fields.....}}
</form>

So.. there is a problem. Why “action” is not specified in the HTML while I defined it into the controller.

Regards

Symfony doc: https://symfony.com/doc/current/forms.html#changing-the-action-and-http-method

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *