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.
Hi!
You can either customize the errors using ajv-errors
or the JSON Forms internationalization support (link to preliminary docs).
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-errorsand then hand it over to the
JsonFormscomponent
ajv` prop.
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?
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?