TimWilson
-
Posts
3 -
Joined
-
Last visited
Content Type
Forums
Gallery
Blogs
Events
Store
Downloads
Profiles
Posts posted by TimWilson
-
-
I'm trying to figure out how to do something similar. I have a simple form on a 7.1 site and I'd like to auto-populate a coupon code into the "Offer Code" field of the form based on data gleaned from the URL. (Nothing about the codes are secret in any way. This is just a convenience thing.)
I'm able to get the coupon code from the URL (e.g., site.com/form-page?code=12345) into my variable via javascript, but it seems like I'm having trouble selecting the input field and pasting the value of that variable. Here's a snippet of the relevant form HTML:
<div id="64ba7865-b8b9-4e6d-8a30-cb7b00c984d3" class="form-item field text required"> <label class="title" for="64ba7865-b8b9-4e6d-8a30-cb7b00c984d3-field"> Offer Code <span class="required" aria-hidden="true">*</span> </label> <input class="field-element text" type="text" id="64ba7865-b8b9-4e6d-8a30-cb7b00c984d3-field" placeholder="ALG-" aria-required="true"> </div>
Any suggestions? I've tried using querySelector on the input id as well as the class. (It's the first instance of an input with that class, so it should be relatively straightforward.)
Auto-populate the Country field in the Contact Form
in Customize with code
Posted · Edited by TimWilson
@creedon, here's the link:
https://www.acuityleadershipgroup.com/test-drive
You can test passing the code by adding a "c" variable to the URL like this:
https://www.acuityleadershipgroup.com/test-drive?c=12345