APIs & Integrations

justwil
Member

Controlling a native Hubspot form using api or javascript

SOLVE

Hey Guys,

 

We have been getting an insane amount of spam emails through our lead forms. Captcha isnt working and blocking the domains are not working as well. We decided to sign-up for Neverbounce and use their API to validate the email address on the form.

Are you able to control a native Hubspot form using the API or Javascript on the the Hubspot landing page? Can i can control it by stopping the form submission and connecting the Neverbounce API to validate the email address and if its valid...submit the form?

0 Upvotes
1 Accepted solution
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Controlling a native Hubspot form using api or javascript

SOLVE

@justwil I've not done this before but this article shows you how to prevent submit, add custom validation, and submit after that validation is successful within onFormReady using Query Validation Plugin. If Neverbounce has similiar functions you can plugin into you might could pull off the same mechanics.
https://rschu.me/prevent-the-submit-of-any-hubspot-forms-after-a-successful-validation-5e1f230b14f1

If you don't want to use the embed code for the form you can use an event listener to use the callbacks.

https://legacydocs.hubspot.com/global-form-events

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

4 Replies 4
justwil
Member

Controlling a native Hubspot form using api or javascript

SOLVE

Thanks @dennisedson!

 

According to this post: https://community.hubspot.com/t5/APIs-Integrations/Prevent-Form-submission-after-successful-Validati... It's not possible to control the form using the onFormSubmit callback. Another thing is that im not using the form embed code becasue my website is hosted in Hubspot...im using the form builder in Hubspot. On top of that, i tried that exact same code (outside of hubspot... externally) in that post using the onFormReady callback and it didn't work.

0 Upvotes
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Controlling a native Hubspot form using api or javascript

SOLVE

@justwil I've not done this before but this article shows you how to prevent submit, add custom validation, and submit after that validation is successful within onFormReady using Query Validation Plugin. If Neverbounce has similiar functions you can plugin into you might could pull off the same mechanics.
https://rschu.me/prevent-the-submit-of-any-hubspot-forms-after-a-successful-validation-5e1f230b14f1

If you don't want to use the embed code for the form you can use an event listener to use the callbacks.

https://legacydocs.hubspot.com/global-form-events

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
dennisedson
HubSpot Product Team
HubSpot Product Team

Controlling a native Hubspot form using api or javascript

SOLVE

@justwil 

You aren't trying to not submit the form, correct?  You just want to delay it for additional validation via this third party API.  Am I reading that correctly 😬

You can use the embed code in HubSpot.  You could make a custom module for it for easy use for the marketing team. 

@alyssamwilie , @dbeau79  can either of you offer some advice here?

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Controlling a native Hubspot form using api or javascript

SOLVE

Heyo @justwil 

Sorry about the spam issue 😞

You can look at this doc for how you can customize the form embed code.  I believe you will want to look at the onFormSubmit callback

0 Upvotes