Description
I have a schema that includes a few array properties that I need to include a property on the array's contents objects. The property differs depending on which object in the array it is.
For example:
Schema:
{
type: 'object',
title: 'MyObj',
properties: {
PointOfContact: {
type: 'array',
items: {
type: 'object',
properties: {
isPrimary: {
type: 'boolean',
},
Name: {
type: 'string'
}
}
}
}
}
}
So for my form, I need to display primary POC and alt POC fields.
Form:
[
{
key: 'PointOfContact[0].Name'
},
{
key: 'PointOfContact[0].isPrimary'
},
{
key: 'PointOfContact[1].Name'
},
{
key: 'PointOfContact[1].isPrimary'
}
]
I need my model's PointOfContact[0].isPrimary to = true, and false otherwise. I'd rather not have this field displayed because it doesn't make sense to do so. I have similar cases where objects in the array need to be displayed as fields in the form, but for the model, I need to include a specific foreign key value for that field's target object.
My understanding is, the point of schema forms is to reduce the need for doing things manually, so the lack of an ability to apply a value to the modal without rendering it on the form, or supplying a hidden input type even is boggling.
I guess I could create a new form type 'hidden' to supply the additional values I need to my model?
So my question to the community: Am I approaching this wrong? What am I missing here?