Skip to content

Commit

Permalink
✨ Suport all form submission methods
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Feb 25, 2024
1 parent edc0c3d commit 125d8b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Allow `Hawkejs.RESULT` properties to be functions
* Add `Element.setStylesheetHandler(fnc)` to add custom stylesheet handling of custom elements
* Don't apply the custom-element options twice when a sync render is requested
* Support all form submission methods

## 2.3.17 (2024-02-19)

Expand Down
11 changes: 7 additions & 4 deletions lib/client/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -3152,7 +3152,7 @@ Scene.setMethod(function markElementBusy(element, busy) {
*
* @author Jelle De Loecker <[email protected]>
* @since 2.0.0
* @version 2.2.20
* @version 2.3.18
*
* @param {HTMLElement} form
* @param {HTMLEvent} e
Expand Down Expand Up @@ -3205,12 +3205,15 @@ Scene.setMethod(function onFormSubmit(form, e, options) {
options.scroll = true;
}

if (!method || method.toLowerCase() == 'post') {
options.post = form_data;
if (method) {
method = method.toLowerCase();
} else {
options.get = form_data;
// @TODO: should default to GET in the future
method = 'post';
}

options[method] = form_data;

// Set the form we're submitting as the source_element
options.source_element = form;

Expand Down

0 comments on commit 125d8b4

Please sign in to comment.