Hi
I’m testing the non-hubspots forms integration. With a simple form it works fine:
<style>
#btnCreate {
background-color: #FF6347;
}
#btnCreate:hover {
background-color: #F04D30;
}
</style>
<form action="[ENDPOINT]" method="get">
[...]Several inputs[...]
<div style="text-align: center;">
<input id="btnCreate" type="submit" value="Crear cuenta" style="border: 0px solid #000000; border-radius: 10px; font-family: Aileron; font-size: 20px; font-weight: 700; box-shadow: 0px 5px 5px #BE7062">
</div>
</form>
It creates a contact on Hubspot and out backend can access to that contact to add tasks and do stuff
But I am unable to make it work with Google Recaptcha v3 (https://developers.google.com/recaptcha/docs/v3#programmatically_invoke_the_challenge). So far on our frontend we invoked the challenge programmatically and only after validation the action was executed. But reading Hubspot documentation (Use non-HubSpot forms y Pop-up forms (legacy) | Frequently Asked Questions) I understand that I cannot include Google Recatcha as usual and then using Javascript submit the form, is that right? Something as:
<style>
#btnSend {
background-color: #FF6347;
}
#btnSend:hover {
background-color: #F04D30;
}
</style>
<form id="web_contacto" action="[ENDPOINT]" method="post" name="web_contacto">
[...]
<div style="text-align: end;">
<button id="btnSend" style="border: 0px solid #000000; border-radius: 10px; font-family: Aileron; font-size: 16px; font-weight: 700; box-shadow: 0px 5px 5px #BE7062" class="g-recaptcha"
data-sitekey="..."
data-callback='onSubmit'
data-action='submit'>Enviar</button>
</div>
</form>
[...]
<script src="https://www.google.com/recaptcha/api.js"></script>
<script>
function onSubmit() {
[...]
document.getElementById("web_contacto").submit();
};
</script>
This works as intended on the front, the form is sent, and on the back, the server do the stuff it has to do, but it does not create a contact in Hubspot nor registers the form submission on the marketing → lead caption → forms page. So I’m guessing that acording to what I have understand from the documentation, it I use js to submit the form, Hubspot does not register it.
Am I understanding it correctly? If that’s the case, whats the recommended practice to use Google recaptcha and Hubspot on the same form. If not, what else am I doing wrong?