[Solved] How to make a selection using documents from another Collection


#1

Hi, I am using autoform to create some forms for my Collections, and I was wondering how can I create a select input using the information from another Collection, right now this is what I have on my SimpleSchema but it’s not working, the app doesn’t show me nothing on the selector, just the first one that reads (Select One), any ideas how I can make this work? Thanks!

marca: {
    type: String,
    label: "Marca",
    autoform: {
            options: function () {
                var opciones = [];
                Categorias.find().forEach(function (element) {
                    opciones.push({
                        label: element.nombre, value: element._id
                    });
                });
                return opciones;
            }
        }
  },

#2

Never mind… I just had to subscribe the Collection I was using to ‘autoformModals’ because that is what I was using to display them.