| 1 |
var isFormValidatedWithoutError=function(){"use strict";return async function(e,{step:t}={}){if("undefined"!=typeof validateForm&&!validateForm({form:e},{step:t}))return new Promise(((e,t)=>{t(new Error("Form is not valid"))}));const n=document.getElementById(e);n.classList.add("pos-rel","form-loading");let a=new FormData(document.getElementById(`form-${e}`));const d=window.bf_globals[e],{grecaptcha:i}=window;if("v3"===d?.gRecaptchaVersion&&d?.gRecaptchaSiteKey){const e=await i.execute(d?.gRecaptchaSiteKey,{action:"submit"});a.append("g-recaptcha-response",e)}"undefined"!=typeof advancedFileHandle&&(a=advancedFileHandle(d,a)),"undefined"!=typeof decisionFldHandle&&(a=decisionFldHandle(d,a)),"undefined"!=typeof hideChildFldHandle&&(a=hideChildFldHandle(d,a)),d.GCLID&&a.set("GCLID",d.GCLID),t&&a.set("form-current-step",t);const o=[];Object.entries(d?.fields||{}).forEach((e=>{e[1]?.valid?.hide&&o.push(e[0])})),o.length&&a.append("hidden_fields",o);const r=new URL(d.ajaxURL);r.searchParams.append("action","bitforms_before_submit_validate");const s=await fetch(r,{method:"POST",body:a}),c=await s.json();return n.classList.remove("pos-rel","form-loading"),c.success?new Promise((e=>{e(!0)})):(bfValidationErrMsg(c,e),new Promise(((e,t)=>{t(new Error("Form is not valid"))})))}}(); |