I have a custom field for a contact form that I need to fill with marketing tags. Salesforce needs to receive this along with all of the other fields. This is accomplished using Zapier, and all I need do is fill out the field.
The data I use to fill out the field are parameters passed via the URL. Specifically UTM parameters from Google Ad campaigns, or other campaigns with other marketing platforms.
I believe I need to use Corvid methods to set the value, since that should properly handle React correct? That would seemingly be straightforward, but every time I try to use $w it complains it is not defined. I’ve imported wix-data and wix-window, and that doesn’t help. It seems that no matter what, $w is not initiated yet. I’ve tried to delay my code till all other scripts are loaded, but that doesn’t help either. Meaning, a timeout for 10 seconds doesn’t allow $w to be defined.
document.getElementById("comp-k7xt3ajatextarea").value = utm_code;
I’m running my code in a custom element connected to a Corvid file. That custom element is placed inside the form.
Where and how can I use $w to set the input value for our custom field, and how can ensure it propagates correctly with the other fields?
Thanks