Skip to content

Commit

Permalink
Add cf: events
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Apr 18, 2024
1 parent 9e9b1e5 commit 2b3ff66
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions public/campaign-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const postScriptLoad = function () {
window.campaignForm.successCallback(data.master_person_id)
}
campaignForms[formId].submittedCallback?.(form)
form[0].dispatchEvent(new CustomEvent('cf:form-submitted', {
detail: {
formData: form.formData()
}
}))

// redirect if setup
if (typeof data.redirect_url !== 'undefined') {
Expand Down Expand Up @@ -180,6 +185,12 @@ const postScriptLoad = function () {
})
})

document.dispatchEvent(new CustomEvent('cf:loaded', {
detail: {
formData: campaignForms
}
}))

toggleSubmitButtons(false);
})(jQuery)
}
Expand Down

0 comments on commit 2b3ff66

Please sign in to comment.