Controlling a native Hubspot form using api or javascript

SOLVE
justwil
Member

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

Accepted Solutions
amwilie
Solution
Key Advisor | Elite Partner

@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

border

Alyssa Wilie

Web Developer at LyntonWeb

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

View solution in original post

4 Replies 4
dennisedson
Community Manager

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

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
justwil
Member

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
dennisedson
Community Manager

@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. 

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

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
amwilie
Solution
Key Advisor | Elite Partner

@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

border

Alyssa Wilie

Web Developer at LyntonWeb

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

View solution in original post