Hi Webflow Community,
I am interested in taking the value of a first-party cookie (I have been successful in setting such a cookie in the browser) and insert it into a hidden field in a standard Webflow Form. I am able to create the cookie (taking values from a URL query) using Google Tag Manager and store it in browser. However, I have tried many attempts at using some sort of script to insert the cookie value into a hidden form field with no success. I can verify that the cookie is stored, but have been unsuccessful in populating a hidden form field with the cookie. The page I would like to do this:
The code I attempted to use to insert cookie value into field based on previous success:
<script> document.getElementById("urlsource").value = readCookie("source"); </script>
where the hidden field in the form looks like:
<input type="hidden" class="urlsource" id="urlsource" value="">
I have done this many times successfully using a different site builder, and would love to get this working on my Webflow site! Any help would be much appreciated!