APIs & Integrations

ikknd
Participant

Form validation / error message + not allow duplicate email

Résolue

We have a form where users can ask for a demo account.

- How can we prevent users from submitting form again, with the same email address?

- In Hubspot form setting I have only seen option to redirect to another page OR display a thank you message - is it possible to have both? 

- Is it possible to first validate if email can be used, if no - display an error message that this email has already been used?

0 Votes
2 Solutions acceptées
alyssamwilie
Solution
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

Form validation / error message + not allow duplicate email

Résolue

@Kevin-C They would have to delay the redirect though. I've often run into a problem with trying to use contact properties right after form submission and the submission not having updated the contact quick enough to be usable.

 

@ikknd He's not talking about using the API, but instead using a contact property after form submission to determine what content is shown on the page you redirect to either using HubL or smart content.

 

I don't believe Hubspot has any sort of  validation available in their API. If you want to validate before/on submission you would need to use the Contacts API to get the contact by their email and then you can either search for a property in the form to see if it's filled out or have a list that users are being put into on form submission and see if they're in that list. Then submit the form or show an error depending on if they're in the list/have the property or not. @Kevin-C does mention serverless functions, this would allow you to use the API without an integration but it's an Enterprise only feature.

 

That's about as much as I can tell you. I don't really work with the APIs much. 😅

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.

Voir la solution dans l'envoi d'origine

Kevin-C
Solution
Expert reconnu | Partenaire solutions
Expert reconnu | Partenaire solutions

Form validation / error message + not allow duplicate email

Résolue

Yeah I kinda forgot what forum I was in and went on a tanget…

 

Back on track!

The V3 CRM API will return an error if you try to create a contact with a duplicate email address.

Alternatively using the READ (get) or SEARCH(post) endpoint you could manually compare the values.

 

Below I've include a few successful test responses:

 

CREATE:

KevinC_2-1625091501959.png

 

SEARCH:

KevinC_1-1625091463456.png

 

READ:

KevinC_0-1625091417982.png

 

 

Kevin Cornett - Sr. Solutions Architect @ BridgeRev

Voir la solution dans l'envoi d'origine

10 Réponses
alyssamwilie
Solution
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

Form validation / error message + not allow duplicate email

Résolue

@Kevin-C They would have to delay the redirect though. I've often run into a problem with trying to use contact properties right after form submission and the submission not having updated the contact quick enough to be usable.

 

@ikknd He's not talking about using the API, but instead using a contact property after form submission to determine what content is shown on the page you redirect to either using HubL or smart content.

 

I don't believe Hubspot has any sort of  validation available in their API. If you want to validate before/on submission you would need to use the Contacts API to get the contact by their email and then you can either search for a property in the form to see if it's filled out or have a list that users are being put into on form submission and see if they're in that list. Then submit the form or show an error depending on if they're in the list/have the property or not. @Kevin-C does mention serverless functions, this would allow you to use the API without an integration but it's an Enterprise only feature.

 

That's about as much as I can tell you. I don't really work with the APIs much. 😅

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.
ikknd
Participant

Form validation / error message + not allow duplicate email

Résolue

@alyssamwilie thank you for your help, this has clarified a lot of questions I had

Kevin-C
Expert reconnu | Partenaire solutions
Expert reconnu | Partenaire solutions

Form validation / error message + not allow duplicate email

Résolue

Thanks @dennisedson 

 

Hey @ikknd 

 

I also believe @alyssamwilie is correct. But your usecase leads me to believe there might be other options.

 

I'm wondering if this has to be an api / validation thing. What if the content on the page the contact is redirected to is conditional?

Maybe a hidden boolean contact info field in the form. Then on the redirected page query against that field.

This way we declare what we want to happen based on the contacts info vs checking the submission.

 

I could also see something like this being done with a serverless function, if you have access to them. But I still feel like the first option might serv you better.

 

@alyssamwilie @dennisedson  Thoughts?

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
ikknd
Participant

Form validation / error message + not allow duplicate email

Résolue

@Kevin-C Thank you for the suggestions.

I am a bit new to Hubspot integrations, could you clarify which api/validation are you talking about?

Is there API that Hubspot offers, that I could use for email "duplicate" validation?  Or is this something that we need to develop by ourselves?

 

Basically we need to do the validation before the form is submitted, via javacript?

Kevin-C
Solution
Expert reconnu | Partenaire solutions
Expert reconnu | Partenaire solutions

Form validation / error message + not allow duplicate email

Résolue

Yeah I kinda forgot what forum I was in and went on a tanget…

 

Back on track!

The V3 CRM API will return an error if you try to create a contact with a duplicate email address.

Alternatively using the READ (get) or SEARCH(post) endpoint you could manually compare the values.

 

Below I've include a few successful test responses:

 

CREATE:

KevinC_2-1625091501959.png

 

SEARCH:

KevinC_1-1625091463456.png

 

READ:

KevinC_0-1625091417982.png

 

 

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
ikknd
Participant

Form validation / error message + not allow duplicate email

Résolue

@Kevin-C thank you so much for the help, now I know which direction to take

0 Votes
Kevin-C
Expert reconnu | Partenaire solutions
Expert reconnu | Partenaire solutions

Form validation / error message + not allow duplicate email

Résolue
I’m now wondering if we could check if the contact has filled out the form before? I’ll have to get back to this.
Kevin Cornett - Sr. Solutions Architect @ BridgeRev
Kevin-C
Expert reconnu | Partenaire solutions
Expert reconnu | Partenaire solutions

Form validation / error message + not allow duplicate email

Résolue

I also feel like the first option would avoid more edgecases, while allow you to scale in the future if desired.

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
0 Votes
alyssamwilie
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

Form validation / error message + not allow duplicate email

Résolue

I don't believe this is something you can do efficiently with HubL, javascript, or workflows unless the user's cookie stays intact (which is unlikely), so sorry @dennisedson but I'm no help here. I'm not an API guru 😅

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
Équipe de développement de HubSpot
Équipe de développement de HubSpot

Form validation / error message + not allow duplicate email

Résolue

@Kevin-C , @alyssamwilie --> any thoughts on these questions? 

0 Votes