Pristine and dirty checking

Looking for a solid way to perform pristine and dirty checking at a global level of a form element. Currently an element is given an error state on mount when marked required in the JSON schema. I am thinking about creating my own reducer that listens to the internal action calls in JSON forms. Thoughts?

[original thread by Jon Major Condon]

I’m not sure what you are trying to do so please elaborate on your use case :wink: If you want to check which errors exist globally please see this previously answered question.

[Jon Major Condon]

Sure (: I want to capture pristine/dirty and touch states of inputs rendered with jsonforms. Currently when you render a field that is marked required it renders with errors. I don’t want to render with errors on mount; instead I want to render errors based on either pristine/dirty and touch states

Currently we don’t support suppressing the displayed errors. To achieve this without changing JSON Forms itself you would need to implement your own renderers (which could mostly re-use the existing control renderers) which also take your additional states into account to determine whether they should show errors or not.

However we are definitely open for changes to JSON Forms and actually thought about similar use cases (mostly related to asynchronous cases where the errors might be computed later or language support where existing errors might be modified). It would be nice to have init and update actions which don’t immediately calculate and set the errors, as well as a specific set-errors action to manually set them. If there were such actions you could use them to implement your use case. We welcome any contribution to this topic :wink:

[Jon Major Condon]

Awesome! Thanks much for the answer! (:


Hi Jon, I have this same use case. I am currently working on these related pull requests.

[Jon Major Condon]

Awesome! :clap: