In react standalone jsonforms required field validation does not get triggered for empty strings and asigning undefined results in react warning for changing controlled to uncontrolled component

Problem: In my react standalone jsonforms application, I have a required field with string type. When once field is filled up and then cleared up, the required error message is not shown. It needs to be set as undefined for error to be triggered for this field. But changing value from string to undefined or vice versa, it results in react warning saying ‘A component is changing an uncontrolled input to be controlled’, as shown in below screenshot too.
Question: Is there a solution to trigger required property error with empty string and arrays?

Hi @manju2791, this doesn’t look like a validation problem to me. I see that you use a custom text renderer. From the error message I’m assuming that you hand over the data prop directly to the text input. Many React components, including the ones from Material UI, distinguish between controlled and uncontrolled mode by checking their “value” prop. In case it’s undefined they use uncontrolled mode.

Therefore you should be able to fix this by handing over data ?? '' to your TextField. Then it’s always in controlled mode. This has no effect on the validation because the data will still be undefined.