I’m using SimpleSchema and Autoform together.
One of my schemas is frequently wrapped in array brackets and included / referenced by a larger schema.
I mean something like this, where MyLargerSchema would at the end of the day include two attributes of type [MySubschema]…
MySubschema = new SimpleSchema({
attribute1: {
type: String,
optional: true,
label: "My attribute1",
},
attribute2: {
type: String,
optional: true,
label: "My attribute2",
},
})
MyMediumSchema = new SimpleSchema({
my_medium_attribute: {
type: String,
optional: true,
label: "My medium attribute",
},
my_attributes2: {
type: [MySubschema],
label: "My attributes2",
optional: true,
},
})
MyLargerSchema = new SimpleSchema({
my_attributes1: {
type: [MySubschema],
label: "My attributes1",
optional: true,
},
my_medium_attributes: {
type: MyMediumSchema,
label: "My medium attributes,
optional: true,
},
})
For MyLargerSchema we have an autoform like this…
{{#autoForm collection="mycollection" id="myid" type="insert"}}
{{> afQuickFields name='my_attributes1'}}
{{> afQuickFields name='my_medium_attributes'}}
{{/autoForm}}
How can I tweak the autoform invocation so as to set minCount=1 for all the [MySubschema] fields of the resulting form?