Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translate FormBuilder#button calls with formmethod:
When submitting a `<form>`, browsers will serialize the element that initiated the submission as part of the [FormData][], including its `name` 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][_method]. 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. [FormData]: https://developer.mozilla.org/en-US/docs/Web/API/FormData [_method]: https://edgeguides.rubyonrails.org/form_helpers.html#how-do-forms-with-patch-put-or-delete-methods-work-questionmark [button-formmethod]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formmethod
- Loading branch information
1 parent
46165a0
commit b8c9c9d
Showing
4 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters