Seems like this has been a topic before, but not finding a solution that works - same exact issue as Couldn’t find target container #hbspt-form-hubid, form is created and I can see it being rendered on the page, but the console is telling me that it’s NOT rendered and thus submissions don’t work at all.
Live page with form: https://zogculture.com/why-play/
Code used to embed:
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/shell.js"></script>
<script charset="utf-8" type="text/javascript" src="//js.hubspot.com/forms/current.js"></script>
<script>
hbspt.forms.create({
portalId: '3266474',
formId: '9840b39a-4fb7-45c2-a685-2a9208289f26',
css: '',
target: '#hubspot-form--<?php echo $random; ?>',
formInstanceId: '<?php echo $random; ?>',
onFormReady: function( $form ) {
$form.attr( 'target', 'hubspot-iframe');
}
});
</script>
<div id="hubspot-form--<?php echo $random; ?>"></div>
<iframe name="hubspot-iframe" id="hubspot-iframe"></iframe>
($random is just a PHP variable to generate a random number between 1 and 1000000)
Anyone find a fix for this that works successfully (or have an idea that might be worth a shot)?