Hi all,
I’m trying to build a questionnaire with @jsonforms/react and @jsonforms/material-renderers.
This questionnaire is spreaded over multiple categories (or tabs).
When submitting the form to the back-end, I can get the list of fields in error, and so the associated category (or tab).
Is there, by any chance, a way to control the currently displayed category (or tab)?
Hi @CharlesCoqueret ,
thanks for reaching out. I’d like to clarify what you want to do. Do you want to set the selected category from outside of JsonForms, i.e. as a property to the <JsonForms>
component?
Hi @lucas-koehler,
Yes.
The specific objective is to get focused on the first tab that contains the field in error.
Hi @CharlesCoqueret ,
I see. Unfortunately, there is no out of the box behavior in JsonForms to support this. Two solutions come to mind:
- Implement a custom categorization renderer whose selected tab can be controlled from outside JsonForms. E.g. by using a react context that gets the selected index (or a getter for this) from said context.
- Or a hacky solution: Simulate a click on the first tab to select it. However, solution 1 is preferable.
Hope that helps and best regards,
Lucas