FORM with an action URL containing a query param is not submitted.
srbartlett opened this issue · 1 comments
Hey all, I am upgrading from Turbo version 7 to version 8 and have observed an issue with a FORM submit.
When the FORM has an action
that contains a url param, the param is not submitted with the request
<form action="/foo/bars?id=12" method="get">
<input type="text" name="query[x]" id="1">
<input type="text" name="query[y]" id="2">
</form>
When the form is submitted, the request is missing the id
param from the form action: GET http://localhost:3000/foo/bars?query[x]=1&query[y]=2
Previously, using Turbo version 7, the request would include the url param in the form action. eg GET http://localhost:3000/foo/bars?id=12&query[x]=1&query[y]=2
For additional context which may be relevant, the form is submitted using a Stimulus controller this.formTarget.requestSubmit()
If this is expected behaviour I'll fix my code to deal with it. I couldn't find anything in the W3C standards to indicate a url param is not invalid in the context of a form action.
Apologies, the W3C spec would indicate my scenario is invalid. I'll change my code to be compliant.
https://www.w3.org/TR/html401/interact/forms.html#h-17.13.3.4
If the method is "get" and the action is an HTTP URI, the user agent takes the value of action, appends a `?' to it, then appends the form data set, encoded using the "application/x-www-form-urlencoded" content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes.