I just found this awesome autoForm package for Meteor and I want to use it together with select2.
My goal is to use the autoForm to easily create an input form for one of my collections. The obstacle is: how do I populate it with fields from another collection and how do I make it multi-select?
Inside my lib/collections I declare a Meteor collection:
Clients = new Mongo.Collection('clients');
Clients.attachSchema(new SimpleSchema({
clientName: {
type: String,
label: "Mandator Name",
max: 200
}
}));
Now I don't get the documentation on autoForm. On the atmospherejs page (https://atmospherejs.com/aldeed/autoform) I am supposed to use something like this if I am not wrong:
{{#autoForm collection="Clients" id="insertClientForm" type="insert"}}
{{> afFieldInput name="clientName" options=options}}
{{/autoForm}}
And then write some JS like this:
Template.registerHelper({
options: function() {
return Clients.find({}, {fields: {clientName: 1}});
}
});
The template is rendered alright, as in I can see an input box. However it is not a multi-select and it does not allow me to select any values at all.
Any ideas on where the issue is?
Bonus question: How do I use select2 on autoForm generated select inputs? EDIT: Use aldeed:autoform-select2 to use select2.