| 1 |
var setFieldValues=function(){"use strict";return function(e){try{(e?[e]:Object.keys(window?.bf_globals||{})).forEach((e=>{const t=window.bf_globals[e],n=t?.oldValues||{},{fields:c}=t,i=["select","phone-number","country","currency","file-up","advanced-file-up","repeater"],o=["radio","check","decision-box","image-select","gdpr"],l=bfSelect(`#form-${e}`);Object.entries(c).forEach((([c,s])=>{const a=s.typ;let r=s.fieldName;const u=n[c];if(u)if(i.includes(a))t.inits[c].value=u;else if(o.includes(a)){"check"===a&&(r+="[]");const e=l.querySelectorAll(`input[name="${r}"]`),n=u?.split(t?.configs?.bf_separator)||[];if(e.forEach((e=>{if(n.includes(e.value)){e.checked=!0;const t=n.indexOf(e.value);n.splice(t,1)}})),e[0]?.dispatchEvent(new Event("input")),n.length){const e=l.querySelector(`[data-oopt="${c}"]`);if(e){e.checked=!0;const t=l.querySelector(`.${c}-cw input[data-bf-other-inp]`);t&&(t.value=n.join(", "),e.value=n.join(", "),e.dispatchEvent(new Event("input")))}}}else if(u){const t=document.querySelector(`#form-${e} [name="${r}"]`);t&&(t.value=u),t.dispatchEvent(new Event("input"))}}))}))}catch(e){}}}(); |