Github Emulate non-{GET,POST} submissions via button[formmethod] by seanpdoyle ·...
source link: https://github.com/rails/rails/pull/41045
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Contributor
seanpdoyle commented 9 days ago
When submitting a <form>
, browsers will serialize the element that
initiated the submission as part of the FormData, including itsname
and value
attributes.
Browser support for <form>
submission HTTP verbs is limited to GET
and POST
. Rails currently works around this limitation by
constructing <input type="hidden" name="_method" value="VERB">
which
serializes _method="VERB"
to the FormData.
To support varied HTTP actions within the same form, this commit
intervenes when a form.button formmethod: "..."
call is made during
form construction, and translates any formmethod:
value to the
corresponding work-around version.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK