I have simple schema looking like:
Schema = new SimpleSchema
name:
label: "Order title"
type: String
optional: true
offers:
type: Array
optional: true
'offers.$':
type: Object
'offers.$.name':
type: String
min: 3
'offers.$.selected':
type: Boolean
defaultValue: false
Firs I'm inserting new entry into Mongo collection. The, when I already have it, I want to add one more offer into it.
I have tried this code to add new offer into offers array, but it doesn't sent any data into method
+autoForm id="addOffer" schema=Schema type="method" meteormethod="addOffer" doc=data
+afQuickField name='offers.$'
button(type="submit") Add
It seems, that I can only edit all of them at once. E.g. using:
+autoForm id="updateOffer" collection="Order" type="update" doc=data
+afQuickField name='offers'
Should I move offers into separate collection if I want to use autoForm to adding new one without seeing already added offers?
It seems that aldeed just solved the problem in new AutoForm (5.0) release. Now we have update-pushArray
form type.
More info here: https://github.com/aldeed/meteor-autoform#update-pusharray