CMS Development

fordburgess
Member

Add error message to forms

Hello all,

 

I was curious if there was a way to add an error message to a form that displays if the info the user submitted does not meet certain criteria. I currently have all of our forms set to reject emails from free email providers (e.g. gmail, yahoo), but when a user tries to sumbit one of these emails, nothing happens, the submit button simply just doesn't submit. I would like an error message that explains why they can't submit.

 

I have found that when editing forms in the Lead Capture section, I can display a message if an email is equal to a predertimined email, but of course this isn't helpful because there's hundreds of emails I need to block.

 

So, without going into Design Tools and coding a new form entirely from scratch, is there a way I can add an error message that appears after someone tries to submit a form with a free email provider?

0 Upvotes
2 Replies 2
fordburgess
Member

Add error message to forms

Hello Jaycee,

 

Sorry for the delayed response, I was out of office. I did consider doing myself via the JS route, but that would be very time consuming, since I'd have to rebuild all of our forms from scratch. Currently, our forms do all the work under the hood, in terms of sending emails to the user that submitted the form, allowing them to download eBooks and whatnot, and it would be a lot of trouble. I know that for many technologies, users are able to suggest new features to be added, so perhaps that could be something that Hubspot could consider? If I just had the option to add a message if the email contains "gmail.com" (or if the email is from a free email provider) that would be very helpful. At the moment, I only have the option to show another input field.

Screen Shot 2023-06-14 at 12.00.11 PM.png

Thank you, Ford

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Add error message to forms

Hey, @fordburgess 👋 Thanks for your question. I don't think you are missing an in-app option when using a HubSpot form. It's likely possible you can add some JavaScript to your page to do this for you. Do you have developer resources? 

 

Thanks for the additional information! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes