CMS Development

Jools619
Participant

Editing a validation message in Hubspot

SOLVE

Hi

 

Ive put together a page using Drag and Drop in the Design tools and dropped in a hubspot form.

 

I need to change the validation message on the email field which currently says:

 

Please enter your business email address. This form does not accept addresses from gmail.com.

 

Ive looked at the developer docs about this and it looks like i need to add something like:

 

translations: {
        en: {
          forbiddenEmailDomain: "Please enter your business email address"
        }
      }

I have a .js file attached to this page I created, so do I literally need to add the above code into that?

 

Any info much appreciated

Thanks

Jools

1 Accepted solution
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Editing a validation message in Hubspot

SOLVE

@Jools619 you would need use the javascript form embed and then add your translations into the options into that. It would look something like this:

 

<script><!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script> hbspt.forms.create({ portalId: '123456', formId: '123456', locale: 'en', translations: { en: {
forbiddenEmailDomain: "Please enter your business email address"
} } }); </script>

 

 

Stefen Phelps, Community Champion, Kelp Web Developer

View solution in original post

4 Replies 4
BPollastrini
Participant

Editing a validation message in Hubspot

SOLVE

I am no developer, how would I add this code snippet to the form? Do I need to do it for all forms, pelase?

0 Upvotes
stefen
Key Advisor | Partner
Key Advisor | Partner

Editing a validation message in Hubspot

SOLVE

You add this into an HTML area. This will embed the form on the page with said customizations. In other words, you use this embed code instead of the Form Module or Block.

Stefen Phelps, Community Champion, Kelp Web Developer
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Editing a validation message in Hubspot

SOLVE

@Jools619 you would need use the javascript form embed and then add your translations into the options into that. It would look something like this:

 

<script><!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script> hbspt.forms.create({ portalId: '123456', formId: '123456', locale: 'en', translations: { en: {
forbiddenEmailDomain: "Please enter your business email address"
} } }); </script>

 

 

Stefen Phelps, Community Champion, Kelp Web Developer
Jools619
Participant

Editing a validation message in Hubspot

SOLVE

Thanks @stefen 

Yes that worked - I just needed to add a HTML block with that code snippet into the Drag and Drop template

 

 

0 Upvotes