Can I use two different collections in one form using autoform & collection2 package in meteor?
1 answer
You can use the template helper function to populate the parameters for the dropdown. Define a function that returns an array of options objects, then set options
the select field attribute to the name of the function.
Template.appInsert.helpers({
getOptions: function() {
var cursor = YourCollection.find();
return cursor.map(function(doc) {
return {label: doc.name, value: doc._id};
});
}
});
Then use a helper function in your quick definition definition:
{{>afQuickField name='fieldName' options=getOptions}}
+1
source to share