CMS Development

mariana_pic
Participant | Platinum Partner
Participant | Platinum Partner

Javascript Forms Redirect URL not working on custom module.

SOLVE

I've added a form to a custom module using the javascript embed code.

I need to do this because I want to use the callback function.

 

The problem I am having is that:

I am setting the forms to redirect to different URLs depending on the page my custom module is added. I'm selecting this setting in the left sidebar as usual.

But when I test and check the form details the redirect URL is not working. Its always showing the inline thank you message.

 

What can be going on here?

Is this a hubspot bug?



https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options

0 Upvotes
1 Accepted solution
amwilie
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Javascript Forms Redirect URL not working on custom module.

SOLVE

@mariana_pic You need to remove inlineMessage from your form code. As stated in the documentation redirectUrl cannot be used with inlineMessage so it's likely inlineMessage is being given priority.

If this answer solved your question, please mark it as the solution!

border

Alyssa Wilie

Web Developer at LyntonWeb

Kickstart your success on HubSpot's CMS with a theme by the HubSpot experts at Lynton


View solution in original post

4 Replies 4
mariana_pic
Participant | Platinum Partner
Participant | Platinum Partner

Javascript Forms Redirect URL not working on custom module.

SOLVE

I had some back and forth with support because those redirects were not working and i think this is a hubspot bug.

“This particular hubl is expecting an actual URL to be present in the form editor. Since you have selected an internal page from the dropdown, it is instead returning a page ID, which is not populating the URL redirect. Normally with form modules, you use form tags, which the hubl appropriately handles to set the redirect based on the page ID returned, but since you are using a script embed from our form embed code, this option will not be available to you.”

What we did was add an external url in order to get that url redirect populated.

What happened here is that in those pages the RedirectID was still populating and it looks like that generates a conflict and after those redirects were added the workflows stopped working.

After lots of testing and trying things I realized that in the ones that the workflow was still triggering we did not have the RedirectID, and in the ones that were not working we still had it (even after changing the response back to inline message).

What I had to do is hardcode that RedirectID to be an empty string and add a callback function after the form is submitted to add the redirect.

0 Upvotes
mariana_pic
Participant | Platinum Partner
Participant | Platinum Partner

Javascript Forms Redirect URL not working on custom module.

SOLVE

Hello team!

@amwilie thanks for the idea, but that did not work.
Support recommended to add the redirects as external links and that did the trick.

 

But it broke the workflows I had.

I undid all the changes in my english page, unset my redirects and the workflow are still not working.

They do work on the spanish version (where I did not change the redirect.)

So I'm starting to think that if you do any changes to your form (added with javascript) inside a custom module it won't trigger your workflows.

I'm trying to troubleshoot this with support but I'm not finiding a solution and its becoming very frustrating. 

So any help here can be useful.

0 Upvotes
amwilie
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Javascript Forms Redirect URL not working on custom module.

SOLVE

@mariana_pic You need to remove inlineMessage from your form code. As stated in the documentation redirectUrl cannot be used with inlineMessage so it's likely inlineMessage is being given priority.

If this answer solved your question, please mark it as the solution!

border

Alyssa Wilie

Web Developer at LyntonWeb

Kickstart your success on HubSpot's CMS with a theme by the HubSpot experts at Lynton


Jaycee_Lewis
Community Manager
Community Manager

Javascript Forms Redirect URL not working on custom module.

SOLVE

Hi @mariana_pic 👋 Let's see if we can get the conversation going. Hey, @Mark_Ryba @miljkovicmisa @FabianRichter do you have any experience with what @mariana_pic is describing? Or thoughts on how they can troubleshoot this one?

 

Thanks! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes