# Web Forms: Customizing Error Message (Required Fields)

**URL:** <https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [August 2, 2024, 8:34pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639 "2024-08-02T20:34:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RJosefs](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rjosefs/32/203428_2.png) [@RJosefs](https://community.hubspot.com/u/RJosefs)\
**Post date:** [August 2, 2024, 8:34pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/1 "2024-08-02T20:34:40Z")

</div>

Hello:

I want to customize the error message for required fields. The error message should be speficic to each field. For example:

“Please fill out your first name!”

“Please fill out your last name!”

Here are 2 ideas for making this happen, but I need yoru experiuse in how to do this.

**Option 1: Append the message with the field name.**

translations: {  
en: {  
required: “Please fill out” + [name\_of\_field]  
}  
}

**Option 2: Used nested messages for each field.**

translations: {  
en: {  
Field:FirstName {  
required: “Please fill out first name!”  
}  
Field:LastName {  
required: “Please fill out last name!”  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [August 3, 2024, 10:12pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/2 "2024-08-03T22:12:36Z")

</div>

Hi @RJosefs

You can [customise the Form Embed Code](https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options) to add custom validation messages, translations and more.

You can only do this with a Pro or Enterprise subscription because the form must be set to Raw HTML.

Have fun

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of [Webalite](https://www.webalite.com?utm_campaign=community-forum&utm_source=community&utm_content=signature) a Gold HubSpot Partner Agency based in Wellington, New Zealand and the founder of **Portal-iQ** the world’s first automated [HubSpot Portal Audit](https://portal-iq.com?utm_campaign=community-forum&utm_source=community-forum&utm_content=signature) that helps you work smarter with HubSpot.

---

<div class="post-metadata">

**Author:** ![RJosefs](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rjosefs/32/203428_2.png) [@RJosefs](https://community.hubspot.com/u/RJosefs)\
**Post date:** [August 6, 2024, 2:58pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/3 "2024-08-06T14:58:45Z")

</div>

Thank you Mike,

I have the ability to “set to Raw HTML”, but I still don’t know where to create a custom validation message. Do I customize it in the embed code (on website) OR on the form itself (in HubSpot)? And can you send a screen shot or show me where this is done?

---

<div class="post-metadata">

**Author:** ![RJosefs](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rjosefs/32/203428_2.png) [@RJosefs](https://community.hubspot.com/u/RJosefs)\
**Post date:** [August 6, 2024, 3:00pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/4 "2024-08-06T15:00:16Z")

</div>

Thank you [@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259)

I have the ability to “set to Raw HTML”, but I still don’t know where to create a custom validation message. Do I customize it in the embed code (on website) OR on the form itself (in HubSpot)? And can you send a screen shot or show me where this is done?

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [August 8, 2024, 8:15pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/5 "2024-08-08T20:15:04Z")

</div>

Hi @RJosefs

If you are using one form, on one page, then I would customise the embed coded using the HTML Module on the page something like this:

```lia-code-sample
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
 hbspt.forms.create({
 portalId: "123456",
 formId: "AAAAAA-BBBB-CCCC-DDDD-123456789"
 locale: 'en',
 translations: {
 en: {
 required: "Hey! That's required!",
 invalidDate: "Please enter a real date",
 submitText: "Custom Submit Button Text",
 submissionErrors:{ 
 MISSING_REQUIRED_FIELDS: "Please fill in all required fields!" 
 },
 fieldLabels: {
 email: "Electronic mail"
 }
 }
 }
 });
</script>

```

If you need to customise the form on several pages then I would create a [Custom Module](https://knowledge.hubspot.com/design-manager/create-and-edit-modules), that customises the embed code, so you can reuse it.

It took me a while to get my head around it but it was completely worth the effort - I do this all the time.

Have fun

Mike

---

<div class="post-metadata">

**Author:** ![ajwppa](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@ajwppa](https://community.hubspot.com/u/ajwppa)\
**Post date:** [December 17, 2024, 3:53pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/6 "2024-12-17T15:53:10Z")

</div>

Make sure you include the “,” after the Form ID or this won’t work.

---

<div class="post-metadata">

**Author:** ![MTrzcienski](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mtrzcienski/32/205682_2.png) [@MTrzcienski](https://community.hubspot.com/u/MTrzcienski)\
**Post date:** [April 2, 2025, 2:42pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/7 "2025-04-02T14:42:04Z")

</div>

Hi [@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259)! Looking to do this on a form I made but I can’t find how to get the code added to the form. Is there a screenshot or screen recording that you can share?

---

<div class="post-metadata">

**Author:** ![RJosefs](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rjosefs/32/203428_2.png) [@RJosefs](https://community.hubspot.com/u/RJosefs)\
**Post date:** [August 13, 2024, 2:39pm UTC](https://community.hubspot.com/t/web-forms-customizing-error-message-required-fields/113639/8 "2024-08-13T14:39:13Z")

</div>

[@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259)I read your replies twice to make sure I did not miss anything. I do not see a solution for creating a custom error message for each required field. I only see a solution for customizing the error message for ALL fields (that’s generic). I need this:

First Name Field =\> Please fill in your first name.

Last Name Field =\> Please fill in your last name.

Company Name Field =\> Please fill in your company name.
