You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a form isn't valid, Turbo expects a HTTP 422 code to be returned.
Otherwise form errors aren't handled correctly.
Actual Behavior
This bundle is using the old way of calling $this->render('...', ['form' => $form->createView()]).
This always returns a HTTP 200 code regardless of form errors.
Expected Behavior
Every form of this bundle should return a HTTP 422 when given data isn't valid.
Steps to Reproduce
Using Hotwire Turbo and this bundle, submit any form with invalid value and see the problem: no error displayed and no redirection.
Possible Solutions
As of Symfony version 5.4, you can use the renderForm() method: $this->renderForm('...', ['form' => $form]) (see: https://symfony.com/doc/5.4/forms.html#rendering-forms).
Note that, as of Sf 6.2 the renderForm() method is deprecated in favor of directly passing the FormInterface instance to render(): $this->render('...', ['form' => $form])
The text was updated successfully, but these errors were encountered:
When a form isn't valid, Turbo expects a HTTP 422 code to be returned.
Otherwise form errors aren't handled correctly.
Actual Behavior
This bundle is using the old way of calling
$this->render('...', ['form' => $form->createView()])
.This always returns a HTTP 200 code regardless of form errors.
Expected Behavior
Every form of this bundle should return a HTTP 422 when given data isn't valid.
Steps to Reproduce
Using Hotwire Turbo and this bundle, submit any form with invalid value and see the problem: no error displayed and no redirection.
Possible Solutions
As of Symfony version 5.4, you can use the
renderForm()
method:$this->renderForm('...', ['form' => $form])
(see: https://symfony.com/doc/5.4/forms.html#rendering-forms).Note that, as of Sf 6.2 the
renderForm()
method is deprecated in favor of directly passing theFormInterface
instance torender()
:$this->render('...', ['form' => $form])
The text was updated successfully, but these errors were encountered: