I'm using Divi, ACF and Hubspot.
I have a hubspot form, added in a Code Module within Divi (which, I have learned, can not have any php in it), that redirects to gated content on my clients site. I would like for the client to be able to change the URL using an ACF field in the backend rather than having to dive into the code.
I can see that the ACF field URL is available as I can attach it to a button.
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "XXX",
portalId: "XXX",
formId: "XXX",
onFormSubmit: function($form) {
setTimeout( function() {
var formData = $form.serialize();
window.location = acf.get_field('gated_content_url');
}, 300 );
}
});
</script>
The code that I have works when using an absolute URL but I'm trying to feed the ACF field in as the redirect URL.