Form submit with javascript

Hi there!

I am using a non-hubspot contact form.

If I use document.getElementById(“myCustomForm”).submit(); on a separate javascript file, Hubspot does seem to process the data. In other words, I don’t get an email with the form submission.

I need to do document.getElementById(“myCustomForm”).submit(); because I am redirecting to another page with a long query string of data that I collect on a separate javascript file.

Any ideas how to make this work?

Hi @bsastre ,
Jquery code to reload this:
<script>
$(‘#<formid>’).submit();
</script>
But Please use HubSpot Forms API for storing form data and use the ajax with callback function from frontend and use serverless function or any other programming language. Make sure saves all needed information into form submissions list.
Hope this will work for you.
HubSpot form api Link : https://legacydocs.hubspot.com/docs/methods/forms/submit_form

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.