# bit-form/2.10.0/assets/setFieldValues.min.js

Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator &amp; Custom Form Builder, version 2.10.0. 2 lines.

- Page: https://pluginprobe.com/plugins/bit-form/2.10.0/code/assets/setFieldValues.min.js
- Raw: https://pluginprobe.com/plugins/bit-form/2.10.0/raw/assets/setFieldValues.min.js
- Modified: 2023-07-16T07:55:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/bit-form/2.10.0/code/assets/setFieldValues.min.js#L10-L20`.

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

```
