You just need the teknklFormsPlus-0.2.0-Util include <script> and the code from the JS pane in another <script>. The other stuff is just there to have the demo load an actual form.
Awesome, that makes total sense!
Does this looked like it was installed correctly? I wasn't getting UTM results pulled-in. I figure i have it installed wrong.
Can you provide your URL please?
Sure!
Here is an LP with that code installed on it: https://pages.datastax.com/2018_04_05-Designer-Webinar-Microsoft-Azure-DSE-DMC_UTM-Fix.html
If you look in your browser's F12 Console you'll see this 412 error on formsplus-util:
That's 'cuz you have to download the JS file onto your own server and serve it from there. It's for your own protection -- I can't afford to run a CDN for everyone who might use the file!
My bad lol. That makes sense the script works great!
Thank you so much!
Boone White
Hi Sanford,
We are having an issue related the topic, and wondering if you can help this. I've added the code you provided above and updated with our form in the link:
However, I checked the record and the person source and promo code fields didn't update.
Here is the parameters I tested:
Here is the script I added:
<script>
MktoForms2.whenReady(function(form) {
var hiddenFieldMap = {
LeadSource: {
channel: "query",
selector: "utm_leadsource"
},
Promo_Code__c: {
channel: "query",
selector: "utm_promo_code"
},
RF_Confidence_Level__c: {
channel: "query",
selector: "utm_rf_confidence_level"
},
RF_HQ_Company_Name__c: {
channel: "query",
selector: "utm_rf_hq_company_name"
},
RF_HQ_Industry__c: {
channel: "query",
selector: "utm_rf_hq_industry"
},
RF_GHQ_Annual_Revenue__c: {
channel: "query",
selector: "utm_rf_ghq_annual_revenue"
},
RF_SITE_Phone__c: {
channel: "query",
selector: "utm_rf_site_phone"
},
RF_SITE_City__c: {
channel: "query",
selector: "utm_rf_site_city"
},
RF_SITE_State__c: {
channel: "query",
selector: "utm_rf_site_state"
},
RF_SITE_Zip__c: {
channel: "query",
selector: "utm_rf_site_zip"
},
RF_SITE_Country__c: {
channel: "query",
selector: "utm_rf_site_country"
},
RF_HQ_Website__c: {
channel: "query",
selector: "utm_rf_hq_website"
},
RF_HQ_Phone__c: {
channel: "query",
selector: "utm_rf_hq_phone"
},
RF_Trade_Name__c: {
channel: "query",
selector: "utm_rf_trade_name"
},
RF_Company_Name__c: {
channel: "query",
selector: "utm_rf_company_name"
},
Address: {
channel: "query",
selector: "utm_address"
},
State: {
channel: "query",
selector: "utm_state"
},
City: {
channel: "query",
selector: "utm_city"
},
Postal_Code: {
channel: "query",
selector: "utm_postal_code"
},
};
/* --- NO NEED TO EDIT BELOW THIS LINE! --- */
var currentCookies = FormsPlus.util.Cookies.get(),
currentQuery = FormsPlus.util.URI.URI().search(true);
var hiddenFields = Object.keys(hiddenFieldMap)
.reduce(function(acc, field) {
var fieldDescriptor = hiddenFieldMap[field];
switch (fieldDescriptor.channel) {
case "cookie":
acc[field] = currentCookies[fieldDescriptor.selector];
break;
case "query":
acc[field] = currentQuery[fieldDescriptor.selector];
break;
case "constant":
acc[field] = fieldDescriptor.selector;
break;
}
return acc;
}, {});
form.addHiddenFields(hiddenFields);
});
</script>
Can you help this when you have moment?
I really appreciate it.
If all the other fields are working, check to see in Admin >> Field Management that you aren't deliberately blocking updates to those 2 fields.
Hi Sanford,
Thanks for the reply. But, none of the hidden fields are being blocked from updating. ..
Have you done as I said in the second response?