• Hello,

    Since the most recent update with WordPress, I encountered an issue with my embedded HubSpot forms on my website. The form itself is still operable but as soon as you try to edit a WordPress page the form currently lives on, the form no longer functions. The code for the form remains in the source code when I check with the code inspector on the actual published page but the form itself just doesn’t show up. The spot on the published page where it should be remains blank.

    When I do inspect the code within WordPress though, I notice that it adds breaks exactly like this <br /> to my embedded form’s code. I erase them and re-publish and nothing happens.

    The entire code snippet is:

    <div class=”newreg-form” style=”width: 70%; display: block;”><!– [if lte IE 8]>
    <script charset=”utf-8″ type=”text/javascript” src=”//js.hsforms.net/forms/v2-legacy.js”></script>
    <![endif]–>
    <script charset=”utf-8″ type=”text/javascript” src=”//js.hsforms.net/forms/v2.js”></script>
    <script><br />
    hbspt.forms.create({<br />
    portalId: ‘386862’,<br />
    formId: ‘2243bd40-1f0c-4429-aaed-35a29cfe5a02’,<br />
    target: ‘.newreg-form'<br />
    });<br />
    </script></div>

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Quick fix might be to use the Classic Editor plugin and set it up to switch between the two by making it the default with the Block Editor as also selectable.

    Mare sure there are no spaces or tabs of any kind in the post editor. When a p or br tag are added, that’s why.

    <div>ONE STRING OF TEXT</div>script>/script>script>/script>script>/script>

    Hi @fresh14

    @swansonphotos is right – those pesky BR tags are BReaking your JavaScript. By removing the spaces (as @swansonphotos suggested) your JavaScript should behave.

    Before

    <script><br />
    hbspt.forms.create({<br />
    portalId: ‘386862’,<br />
    formId: ‘2243bd40-1f0c-4429-aaed-35a29cfe5a02’,<br />
    target: ‘.newreg-form'<br />
    });<br />
    </script>

    After

    <script>hbspt.forms.create({portalId: '386862',formId: '2243bd40-1f0c-4429-aaed-35a29cfe5a02', target: '.newreg-form'});</script>

    Also, I recommend you try the new HubSpot WordPress Plugin. It has a Shortcode which makes it easier to handle forms (and harder to break them).

    Let me know if that works for you.

    Cheers
    Mike

    Thread Starter fresh14

    (@fresh14)

    Thanks everyone. And big thanks to @webalite – what you said about putting everything on one line worked! Appreciate it!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Embedded Form from HubSpot Disappeared After New Update’ is closed to new replies.