From 9e87406b56f638ec1e61564cb1b6f35beabe90e2 Mon Sep 17 00:00:00 2001 From: Caleb Cox Date: Tue, 16 Apr 2024 16:20:05 -0500 Subject: [PATCH] Scope submittedCallback to an individual form --- public/campaign-form.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/campaign-form.js b/public/campaign-form.js index 1bf8783..190d149 100644 --- a/public/campaign-form.js +++ b/public/campaign-form.js @@ -54,7 +54,7 @@ const postScriptLoad = function () { if (typeof campaignForm.successCallback === 'function') { window.campaignForm.successCallback(data.master_person_id) } - window.campaignForms.submittedCallback?.(form) + campaignForms[formId].submittedCallback?.(form) // redirect if setup if (typeof data.redirect_url !== 'undefined') { @@ -147,7 +147,8 @@ const postScriptLoad = function () { form.attr('id', formId) campaignForms[formId] = { validator: validate(form), - formSubmitted: false + formSubmitted: false, + submittedCallback: undefined } campaignForms[formId].v3 = form[0].hasAttribute("data-recaptcha-sitekey");