-
Notifications
You must be signed in to change notification settings - Fork 79
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
Implement Post/Redirect/Get pattern to avoid form resubmission #465
Comments
…ct/get pattern
Maybe it is a bit offtopic, but I've seen undocumented code about |
This said I think we should default on 303 as the intended method is a GET for the redirect. @rhukster ? If you press F5, the form will reset and the browser may or may not pre-fill the data with your input. So basically submitting the form again will be a different form than the one you submitted before. |
When speaking of defaults, I'd also default to I've updated the PR: 7d1c158 |
It does make sense, though because of how the page.url works, you may actually end up going to a different page as pagination and any other grav/query parameter would be lost. |
I am not sure if I understand correct. The current behavior:
The new behavior:
The patch only extends the options and is fully backward compatible. If someone wants something special, he must use a different twig template. I've done that in my code already, as I need to redirect and include a specific anchor: |
I just noticed, that |
Update: The issue is a separate one, so this PR is not directly affected. I've tracked the issue here: #478 |
See: https://stackoverflow.com/q/6320113/14348748
And: https://en.wikipedia.org/wiki/Post/Redirect/Get
It would be nice to have an option to redirect to the same page using a statuscode of
303
. The form plugin has aredirect
option available, and even theprocess
event supports aredirect_code
. But it is not used yet. Also the processing of the parameters does not include thepage
variable. The function always uses the redirect code302
.Suggested fix: #466
The text was updated successfully, but these errors were encountered: