Send Validation Error asynchronousily For entered data

Hi Guys,

I am looking for ideas to implement the below secanrio.
I’m planning to build a input where the user where the user will input thier name and it will check if the username is already exists in db via api. based on that condition i want to show validation error if he/she can have that username. can anyone please suggest any idea as far as my experience with jsonforms 2.5.2 there’s limation with custom validation messages though wanted to know if there’s any better way out there which i can implement and have it working.


Hi @howdyAnkit,

In JSON Forms 3.0 I would usually recommend to just send your data to your end point on any change event from JSON Forms to construct and set an additionalError when a custom error shall be shown.

For an older version of JSON Forms I see two valid approaches:

  • In case the error shall only be shown in the UI without any consequence (e.g. no disabled submit button) then this could be handled in a custom renderer directly. Just maintain your error state locally and show the error on your field whenever you retrieved the validation.
  • The alternative is still a custom renderer setup, however instead of handling the validation directly within the custom renderer you still implement it how you would do it in JSON Forms 3.0. Just instead of setting the additionalError prop you set the error in a custom React context (or custom provide in Vue etc.). The custom renderer then checks the custom context to retrieve its additional errors. This way the error is cleanly handled outside the form and can then for example be used to disable a submit button.