How to change the error message of a required checkbox in a particular sitecore forms??

I have two forms with checkbox on each form. I want to apply different custom error message in each form. So, on 1st form the message should be "Form1 checkbox is required" and on 2nd form the message should be "Form2 checkbox is mandatory".

I want different custom message in different form.

Any Idea?

  • @Keshav Were you able to solve this problem?
    – prabh
    Mar 15, 2021 at 19:15

1 Answer 1


The only way I can think of without writing custom code is to copy the wanted validator items and give them different messages. This approach could work for all validators except the "required" one - which is probably the one you want.

The required validator is a bit a special case. It gets it's message from the dictionary (with key "{0} is required." as described on https://ggullentops.blogspot.com/2017/10/sitecore-9-forms-translating-error.html).

Every field on your form has 2 attributes:

  • DynamicValidationAttribute: this attribute will list all ValidationElements and validate those. All validations you can see on Forms are such ValidationElements. This is an extensible model - you can create your own elements and they will be handled by this attribute.
  • DynamicRequiredAttribute: this one check the "required" field validation. A few problems arise here.. You can't just replace it with your own version and the error message is taken hardcoded from the dictionary as mentioned above.

To conclude.. if you really need this to verify required fields, I think you might need to write your own validator (as a simple required field one) and add some code to make the error message dependent on the form and/or field. Use this validator instead of the ootb required one. Info on how to create a custom validator: https://doc.sitecore.com/developers/91/sitecore-experience-management/en/walkthrough--creating-a-custom-validation.html or https://ggullentops.blogspot.com/2017/10/sitecore-9-forms-custom-validation.html

And a bit of advice: talk to your customer to check if this is really worth it.. it might be a lot of work for the added value.

  • Custom code can't solve my problem because that custom message will be applicable for all the forms in the website.And I want these to implement on multi-site instance.But thank for you help and talking about customer,they don't know the pain of a developer.They want only output.Thanks and have a nice day. Apr 26, 2019 at 5:58
  • I also try to change the error message in checkbox.cshtml under my website\Views\FormBuilder\FieldTemplates. But these will also change the message for the whole instance. Apr 26, 2019 at 6:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.