I have a custom render component. To render select
"serRepYesNo": {
"type": "string",
"enum": [
"Yes",
"No",
"N/A"
],
"values": [
"Yes",
"No",
"N/A"
]
},
In your custom component, you’re allowing users to add comments for each field, with the value structured as { value: 'serRepYesNo', comment: '' }. You need to apply validation so that if the value is “Yes,” the comment field becomes required. How can you implement this validation?
Hi @sdrix,
Thank you for your response! I also wanted to ask about the customer component. Sometimes, it needs to display a string (enum), while other times, the value is an object with the structure { value: string, comment: string }. I’m using the same component because an option should be next to the select field for adding a comment. Is okay to make a validation service that is going to handle this scenario?
This sort of requirement can easily be modeled with a oneOf and will work out of the box for some of the renderer sets.
The UI is likely not what you envision then, so you could customize this with a custom renderer handling both of the oneOf cases in a more user friendly manner, following your designs.