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

Forms with default action wrongly submit to "/" #218

Open
ionelmc opened this issue Nov 6, 2019 · 1 comment
Open

Forms with default action wrongly submit to "/" #218

ionelmc opened this issue Nov 6, 2019 · 1 comment

Comments

@ionelmc
Copy link

ionelmc commented Nov 6, 2019

Eg, a form like:

<form method="post">....

would get parsed out as a form with "/" as action url but instead the current url should be the action url. as per the html5 spec at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm

  1. If action is the empty string, let action be the URL of the form document.
@fillipe-gsm
Copy link

I'm having the same problem.
So far, I am changing the form action manually in the tests, like

response = test_app.get("/base_url")
form = response.form
form.action = "/base_url"
form_response = form.submit()

which also works if the URL is dynamic (e.g., it depends on an object's id):

form.action = f"/base_url/{object.id}"
form_response = form.submit()

It is annoying, but at least it works without having to change the template.

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

No branches or pull requests

2 participants