Skip to content

Commit

Permalink
fix(pat-subform): Fix subform submits not working with pat-inject.
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Oct 23, 2023
1 parent 09822c5 commit 79436cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pat/subform/subform.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import $ from "jquery";
import ajax from "../ajax/ajax";
import Base from "../../core/base";
import events from "../../core/events";
import inject from "../inject/inject";
import logging from "../../core/logging";

Expand All @@ -16,7 +17,12 @@ export default Base.extend({
trigger: ".pat-subform",

init($el) {
$el.submit(this.submit.bind(this));
events.add_event_listener(
$el[0],
"submit",
"pat-subform--submit",
this.submit.bind(this)
);
$el.find("input").on("keyup keypress keydown", this.keyboard_handler.bind(this));
$el.find("button[type=submit]").on("click", this.submitClicked.bind(this));
},
Expand Down Expand Up @@ -76,7 +82,7 @@ export default Base.extend({
if (!$subform.is(".pat-autosubmit")) {
return;
}
return $subform.submit();
$subform[0].dispatchEvent(events.submit_event());
},

submitClicked(ev) {
Expand Down

0 comments on commit 79436cb

Please sign in to comment.