Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid forms should return a HTTP 422 code #383

Closed
Jupi007 opened this issue Jun 2, 2024 · 0 comments · Fixed by #388
Closed

Invalid forms should return a HTTP 422 code #383

Jupi007 opened this issue Jun 2, 2024 · 0 comments · Fixed by #388

Comments

@Jupi007
Copy link
Contributor

Jupi007 commented Jun 2, 2024

Q A
Bug? yes
New Feature? yes
Bundle Version 2.5
Sulu Version 2.5
Browser Version N/A

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 always returns a HTTP 200 code regardless of form errors.

Expected Behavior

Submit an invalid form should return a HTTP 422 when given data isn't valid.

Steps to Reproduce

Using Hotwire Turbo and this bundle, submit a form with invalid value and see the problem: no error displayed and no redirection.

Possible Solutions

Add a kernel.response event listener, and return a http 422 response if an invalid form is returned.
I'm working on a PR.

Jupi007 added a commit to Jupi007/SuluFormBundle that referenced this issue Jun 22, 2024
alexander-schranz pushed a commit to Jupi007/SuluFormBundle that referenced this issue Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant