CMS Development

Andykins
Member

Accessing elements outside of a Hubspot embed form from the onFormSubmit

Context: I have a Hubspot embed form on a clickfunnels page. Originally, I had the form redirect to another funnel page on submit, but this was not tracking conversions in clickfunnels stats.

I tried making a hidden clickfunnels button on the page to submit after the HS form was submitted. However, I'm not able to reference any outside elements from the HubSpot form it seems.

Does anyone know of a solution or work-around to acomplish this goal?

My original code in an attempt to do this:
zzz.png

0 Upvotes
8 Replies 8
Jake_Lett
Guide | Partner
Guide | Partner

Accessing elements outside of a Hubspot embed form from the onFormSubmit

  • What kind of element is the click funnels button? Is it an HTML button or <a>?
  • Do you have inline text after submission or does it redirect to another page? If inline text, what happens if you redirect to another landing page and then click your click funnels button?
  • Have you tried using .click(); https://api.jquery.com/click/
  • Another thing I would try is see if you can do anything else to the button like change the CSS style to see if the click event is the issue or the selecting of the element 
  • Just curious, why are you using click funnels instead of hubspot? 
0 Upvotes
DGuay
Member | Partner
Member | Partner

Accessing elements outside of a Hubspot embed form from the onFormSubmit

Hello,  I have the same issue.  I need help (I'm not a developer !). 

 

I'm trying to add a HubSpot form in a ClickFunnels page. No problem to add the custom javascript in the ClickFunnels page.


My problem is that I don't want two submit buttons. What should I add in the javascript so that when the submit button on the HubSpot form is clicked, it activates the submit button on the ClickFunnels page?

 

Thanks in advance

0 Upvotes
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Accessing elements outside of a Hubspot embed form from the onFormSubmit

Not sure if i'll be much help but…

 

Im curious about how clickfunnels handles a button being clicked.

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
0 Upvotes
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Accessing elements outside of a Hubspot embed form from the onFormSubmit

I ask because if that button is part of the form you might need to programmatically submit the form rather than click the button.

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
Andykins
Member

Accessing elements outside of a Hubspot embed form from the onFormSubmit

That's a good point.
I have a submit button on the embed form which when submitted, is supposed to trigger a hidden clickfunnels submit button. (So the conversion will get tracked in CF)

I'll try the same function but targeting an html button to see if that one gets clicked.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Accessing elements outside of a Hubspot embed form from the onFormSubmit

Hello @Andykins 

Welcome to the Community!

@piersg what do you think about this 🤔

Curious if this is being called too late in the game to actually grab the element from the dom. 

0 Upvotes
piersg
Key Advisor

Accessing elements outside of a Hubspot embed form from the onFormSubmit

Hmm... onFormSubmitted might be too late but onFormSubmit executes after the form is validated, just before the data is actually sent. So try changing that first @Andykins, should work. If not, let us know and if you could give us the address of the page you're seeing the issue we can help further.

Andykins
Member

Accessing elements outside of a Hubspot embed form from the onFormSubmit

I tried your recommendation. I also added a console log in the form submit function to show a value for the element, which it does.
However it's not actually clicking the button.. It feels like the actual trigger('click') just isn't happening.
I've tried variations of the trigger method but none seem to be working.

0 Upvotes