Add JS event on submission

This commit is contained in:
Julien Nahum 2023-03-23 14:17:55 +01:00
parent e473f28ea1
commit 2fcce79c3a
1 changed files with 20 additions and 0 deletions

View File

@ -204,6 +204,26 @@ export default {
form_id: this.form.id
})
if (this.isIframe) {
window.parent.postMessage({
type: 'form-submitted',
form: {
slug: this.form.slug,
id: this.form.id
},
submission_data: form.data()
}, '*')
} else {
window.postMessage({
type: 'form-submitted',
form: {
slug: this.form.slug,
id: this.form.id
},
submission_data: form.data()
}, '*')
}
try {
window.localStorage.removeItem(this.formPendingSubmissionKey)
} catch (e) {}