Skip to content

Commit

Permalink
Merge branch 'master' into ruby315
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirdjavi authored May 2, 2024
2 parents 252693c + bfdeda2 commit c463036
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion public/campaign-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const postScriptLoad = function () {
if (typeof campaignForm.successCallback === 'function') {
window.campaignForm.successCallback(data.master_person_id)
}
form[0].dispatchEvent(new CustomEvent('cf:form-submitted', {
detail: { fields: form.formToArray() }
}))

// redirect if setup
if (typeof data.redirect_url !== 'undefined') {
Expand All @@ -72,8 +75,8 @@ const postScriptLoad = function () {
if (typeof errors.error !== 'undefined')
form.parents('.campaign-form').find('.alert-danger').removeClass('hidden')
// show errors from rails
campaignForms[formId].validator.showErrors(errors)
campaignForms[formId].formSubmitted = false
campaignForms[formId].validator.showErrors(errors)
}
})
}
Expand Down Expand Up @@ -178,6 +181,10 @@ const postScriptLoad = function () {
})
})

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

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

0 comments on commit c463036

Please sign in to comment.