AutoForm provides specialized components for fields with Object or Array types to manage nested data structures.
Object Fields
When using afQuickField for an Object type, it defaults to the afObjectField component. This component renders all subfields as a single group, typically labeled with the object field's name. In the bootstrap3 theme, this appears as a panel with a heading.
Array Fields
When using afQuickField for an Array type, it defaults to the afArrayField component. This component:
- Renders array items as a group labeled with the array field's name.
- Automatically provides UI buttons for adding and removing items.
- Supports
minCount, maxCount, and initialCount attributes to control the number of items.
Constraints on counts:
- You cannot set
minCount lower than the schema-defined minimum. - You cannot set
maxCount higher than the schema-defined maximum. minCount takes precedence over initialCount. If minCount is 1 and initialCount is 0, the initial count will be 1.
To specify options for every item within an array, use the following schema syntax:
'arrayFieldName.$': {
...
autoform: {
afFieldInput: {
options: function () {
// return options object
}
}
}
}