Skip to content

Commit 0f9978b

Browse files
authored
Merge pull request #32 from hydrostack/31-forms-not-keeping-data-and-refresh-by-itself
Make sure to call preventDefault on a form when doing a submit
2 parents 445054f + 26960fc commit 0f9978b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Scripts/hydro.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ document.addEventListener('alpine:init', () => {
668668
this.$component = window.Hydro.findComponent(this.$el);
669669
},
670670
async invoke(e, action) {
671-
if (["click", "submit"].includes(e.type) && ['A', 'BUTTON'].includes(this.$el.tagName)) {
671+
if (["click", "submit"].includes(e.type) && ['A', 'BUTTON', 'FORM'].includes(this.$el.tagName)) {
672672
e.preventDefault();
673673
}
674674
await window.Hydro.hydroAction(this.$el, this.$component, action);

0 commit comments

Comments
 (0)