Hi, this is my code below:
-
I am using the autoform and collection2 packages.
-
I 've created 2 mongo collections (‘Bambinos’ and ‘Associazioni’)
-
Can you please indicate how should I set the field ‘associazione’ within the ‘Schema.Bambinos’ in order
to get multiselection field showing only the ‘Associazioni’ records belonging to the Associazioni collection ? I would like to get the same effect as in the ‘status’ field without hardcoding the allowed values but getting them from an association between the 2 collections.
I hope the question is clear. Thank for your supportSchema = {};
Bambinos = new Mongo.Collection(“bambinos”);
Associazioni = new Mongo.Collection(‘associazioni’,{
schema: {
name: {
type: String,
label: “Associazione”
}
}
});Schema.Bambinos = new SimpleSchema({
nome: {
type: String,
label: “Nome”,
max: 200
},
cognome: {
type: String,
label: “Cognome”
},
status: {
type: String,
label: “Status”,
allowedValues: [“segnalato”,“in prova”,“inserito”,“sospeso”,“abbandono”,“terminato”],
autoform: {
afFieldInput: {
firstOption: “(Seleziona uno stato)”
}
}
},
dataDiNascita: {
type: Date,
label: “Data di nascita”,
min: 0
},
luogoDiNascita: {
type: String,
label: “Luogo di nascita”
//optional: true
},
disciplina: {
type: String,
label: “disciplina”,
allowedValues: [“atletica”,“basket”,“calcetto”,“calcio”,“danza”,“nuoto”,“pallavolo”,“rugby”],
autoform: {
afFieldInput: {
firstOption: “(Seleziona uno sport)”
}
}
},
associazione : {
type: ??? ,
allowedValues: ???,
autoform: {
afFieldInput: {
firstOption: “(Seleziona una associazione)”
}
}
},});
Bambinos.attachSchema(Schema.Bambinos);