# How to add multiple validations for a custom input field

**URL:** <https://jsonforms.discourse.group/t/how-to-add-multiple-validations-for-a-custom-input-field/904>\
**Category:** General\
**Created:** [July 22, 2022, 9:02am UTC](https://jsonforms.discourse.group/t/how-to-add-multiple-validations-for-a-custom-input-field/904 "2022-07-22T09:02:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pankaj-z](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@pankaj-z](https://jsonforms.discourse.group/u/pankaj-z)\
**Post date:** [July 22, 2022, 9:02am UTC](https://jsonforms.discourse.group/t/how-to-add-multiple-validations-for-a-custom-input-field/904/1 "2022-07-22T09:02:26Z")

</div>

Hi, is there a way to add custom messages on a custom input field?  
Let’s suppose I have a custom input field called Email which is required and should be a valid email. It should show a customized message for required as well as wrong pattern conditions.  
I am using react material rendered.  
Any code snippet is highly appreciated.

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [July 22, 2022, 2:29pm UTC](https://jsonforms.discourse.group/t/how-to-add-multiple-validations-for-a-custom-input-field/904/2 "2022-07-22T14:29:34Z")

</div>

Hi!

You can either customize the errors using [`ajv-errors`](https://github.com/ajv-validator/ajv-errors) or the JSON Forms internationalization support ([link to preliminary docs](https://deploy-preview-222--jsonforms.netlify.app/docs/i18n#error-customizations)).

Please use the latest `beta` release of JSON Forms in either case. In case you want to use `ajv-errors` you then need to use version 3 of `ajv-errors`, create a new AJV instance via `createAjv` from `@jsonforms/core`, customize it via ajv-errors`and then hand it over to the`JsonForms`component`ajv` prop.

---

<div class="post-metadata">

**Author:** ![pankaj-z](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@pankaj-z](https://jsonforms.discourse.group/u/pankaj-z)\
**Post date:** [July 24, 2022, 11:45pm UTC](https://jsonforms.discourse.group/t/how-to-add-multiple-validations-for-a-custom-input-field/904/3 "2022-07-24T23:45:47Z")

</div>

Hi Stepfan thanks for the help. We are currently using version 2.5.1 and unfortunately, we don’t want to upgrade to the latest version due to compatibility issues. Is there any other way to implement this?

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [July 25, 2022, 6:27am UTC](https://jsonforms.discourse.group/t/how-to-add-multiple-validations-for-a-custom-input-field/904/4 "2022-07-25T06:27:08Z")

</div>

You can use `ajv-errors` v1 as we’re using AJV v6 in `2.5.1`.

What is the reason you don’t want to upgrade?
