First thanks for this great library. We are building a enterprise app with lots of forms and we are using this library to generate complex form/UI. The app is build using Vue 3 and we are developing a custom renderer set.
One thing we are running into is how to control validation. Ideally we would like to support the following:
- Initially no validation is shown. After a form field is ‘left’ (blur event), the errors are shown for the field if any.
- When a form is “submitted” (handled outside of JsonForms library), all errors need to be shown. For example if a field is never touched but is required; upon submit the “this field is required” message needs to be shown.
- As a response to the form submit, server side errors may be returned. These need to be shown in the form so ideally these need to be ‘merged’ with the JsonForms error state.
Some of the above is addressed to some extend in other topics. However I am wondering what is currently the recommended approach to solve it, maybe there are some new features on the roadmap that can be used in the near future?
I implemented an “isTouched” state using custom renderers. This works fine however the requirement of showing all errors (also untouched fields) upon submit still needs a solution. Same is for handling server side errors.
I am looking into Vue’s provide/inject to make “form state” data available to all renderers, this ‘form state’ data may include isSubmitted: true/false and serverErrors.
Do you have any suggestions and are there any upcoming features in JsonForm that may simplify a solution? Thanks in advance!