Trying to submit a form from js


#1

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.


#3

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?


#4

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!