APIs & Integrations

Fernando_RM
Member

Error on edit form target

Hi All,

We already noticed that HubSpot gives an error if you edit the form target that HubSpot inject using the embed code. We used for open the form response in a new blank page but now does not works. You have to use the default form target.

0 Upvotes
5 Replies 5
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Error on edit form target

Hi @Fernando_RM,

For a form without a redirect URL, that’s the expected behavior. The response sent on submission is a 204, so setting the target attribute to “_blank” just ‘opens’ that 204 in a new tab. If you set a redirect URL, then it should open up that URL in a new tab. It’s possible that some browsers (particularly Chrome) might block this as a popup, however, and there’s no way to prevent that, so use that technique at your own risk.

0 Upvotes
Fernando_RM
Member

Error on edit form target

Yep, exactly, but you don’t get any form error on submit? When y try i get a white page on hubspot url.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Error on edit form target

Hi @Fernando_RM,

I understand; thank you for clarifying. Can you send me a snipped of the code in your onReady() function? The following is working fine for me:

$form.attr("target", "_blank");

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Error on edit form target

Hi @Fernando_RM,

Are you referring to the target parameter included when customizing the form embed code (see below)? Or are you referring to the target that the form information is submitted to?

0 Upvotes
Fernando_RM
Member

Error on edit form target

Hi Derek,

I’m referring to the legacy html property of the form where you can specify
_self, _blank… I’m editing this on formReady vía JS like this:

$form.attr(“target”, “myTarget”).

escribió:

0 Upvotes