Hello All,
I have a WordPress website that uses the HubSpot plugin. We have a library of PDF assets (white papers, eBooks, case studies, etc.) and use HubSpot forms on gated pages to acquire a user’s name and contact info before serving up the requested asset.
My manager has charged me with the task of consolidating these forms into one form that we can embed on multiple WordPress pages, and each page will serve a different asset. After ruling out several different approaches, I decided that the best solution involves calling the form with a Javascript embed (rather than the HubSpot short code] and pre-populating the value of a hidden field with an identifier for the specific asset in question.
I’ve looked through the forums and seen the code to generally accomplish this task, but it’s not working for me. The form loads just fine, and submits just fine, but it’s ignoring my attempt to pre-fill a value in a hidden field.
This is the page in qeustion - https://www.sparkcognition.com/ebook-unlocking-the-operational-value-of-visual-ai/
This is the code I’m using to generate that form:
<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/embed/v2.js”></script>
<script>
hbspt.forms.create({
region: “na1”,
portalId: “xxxxxx”,
formId: “xxxxxx”,
onFormReady: function($form) {
$(‘input[name=“asset_requested”]’).val(“SCE-VAA-EBK”).change();
}
});
</script>
<script>
Can anyone help me understand why the ‘asset_requested’ hidden field is not picking up the “SCE-VAA-EBK” value?
In advance, thanks!