Issue with Custom Coded Form Embed Codes

Hi all,

I was wondering if HubSpot may have recently updated their forms API?

All of our customized embed codes that would redirect based off of specific criterias (i.e. redirect a certain industry selection to a specific meeting link upon form submission) are no longer working.

I am getting the following error in the console:

Here’s an example of the code:

<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/embed/v2.js”></script>
<script>
hbspt.forms.create({
region: “na1”,
portalId: “12345678”,
formId: “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx”,
onFormSubmit: function($form) {
var contactType = $form.find(‘select[name=“contact_type”]’).val();

setTimeout(function() {
if (contactType === “Small Business Owner” || contactType === “Deal Service Providers”) {
window.location.href = “https://www.google.com”;
}
}, 500);
}
});
</script>

Hey there! The Developer Changelog will be your best bet to look for updates or breaking changes. That being said, I do not see a breaking change to the forms endpoints.

Best,

Jaycee