Validation (React JS)

Hi ,

I am using JsonForms in react project .
I want to show the validation only on submit .Initial validation I am hiding using NoValidations.

Later I need to show these validaiton on click of submit button.Can you please let me know how it can be done .

1 Like

Hi @BharathKS77,

This can be accomplished via the validationMode support, see the docs here. As long as the user did not yet click submit, you can hand over ValidateAndHide. As soon as the user clicks submit you can switch to ValidateAndShow which is the default.


Sorry .This may be a silly one .I actually tried this . Initially I am setting the ValidationMode to ‘NoValidation’.

const [currentValidationMode , setValidationMode] = useState(‘NoValidation’);

onChange={({errors, data }) => {

later on click of Submit setting it to ValidateAndShow.


but the forms not getting updated .

Though the error object is getting updated , the UI is not getting re-rendered to show the errors .

Hi @BharathKS77,

The posted code snippets look correct. Can you construct a reproducible example, for example by modifying the JSON Forms React seed, so we can check what’s going on?