APIs & Integrations

aallen0421
Member

Trying to submit a form from js

SOLVE

I am trying to create a form in jquery and gather data from a hubspot form and submit via a js file. Is there something within hubspot that prevents this behavior. I have attached the js file and am able to get alert messages to show from the document.ready function. Trying to call the hubspot form id (hsForm_((guid)) .submit function and it is not running. I have copied and pasted my script into jsfiddle and it does work there. any advise on how to proceed. The reason for this is we need the same info that is being collected in hubspot to be duplicated elsewhere.

0 Upvotes
1 Accepted solution
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Trying to submit a form from js

SOLVE

Hi @aallen0421,

Could you share a live example so I can see your setup? Additionally, would the onFormSubmit or onFormSubmitted events outlined in this documentation work as alternatives to your .submit method?

Isaac Takushi

Associate Certification Manager

View solution in original post

0 Upvotes
2 Replies 2
aallen0421
Member

Trying to submit a form from js

SOLVE

Hi,
Thanks for the reply. We had to restructure our page to get a marketing campaign out asap so I will have to wait until I can test this properly. However, I think the onFormSubmit function may have been the solution I was searching for.
Thanks!

0 Upvotes
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Trying to submit a form from js

SOLVE

Hi @aallen0421,

Could you share a live example so I can see your setup? Additionally, would the onFormSubmit or onFormSubmitted events outlined in this documentation work as alternatives to your .submit method?

Isaac Takushi

Associate Certification Manager
0 Upvotes