Question:
Why is it that when I use javascript to change teh value of an input field it changes on the front end and when the form is submitted the field doesn’t record anything
Product:
I am using the wix editor on the homepage
What are you trying to achieve:
I am trying to capture the referrer information in the script and add it to a hidden input field
What have you already tried:
The code I use is
import wixWindowFrontend from 'wix-window-frontend';
let referrer = wixWindowFrontend.referrer;
$w.onReady(function () {
let nreferrer = referrer.toString();
$w('#input7').value = nreferrer;
console.log(referrer.toString());// Write your JavaScript here
console.log($w('#input7').value);// Write your JavaScript here
});
Additional information:
The console logs the right information, yet it still doesn’t add the information to the inbox form.
Is the field connected to a dataset? According to the docs setting the value won’t change what is submitted when the form is submitted and you’ll need to call setFieldValue() before submit.
This is because the dataset is what gets submitted.