load collections to a quickform in meteor

2019-09-08 09:39发布

I created two seperate schemas for payments collection and memberProfile. Now I need to create a quickform so I could load all the payments relevant to a unique memberProfile.

     //The code for memberPayment collection

MemberProfiles = new Mongo.Collection('memberProfiles');


RecipeSchema = new SimpleSchema({
name: {
    type: String,
    label: "Name"
},
desc: {
    type: String,
    label: "Description"
},
payments:{
    type: [PaymentSchema],
    autoValue: function () {
        return Payments.find({ memberId="uniqueId"});
    },

     defaultValue: function () {
         return Payments.find({memberId="uniqueId"});
    },

},

// The code for payments collection

 PaymentSchema = new SimpleSchema({
name:{
    type: String

},
amount:{
    type: String
},
memberId:{
    type: String
},


});

This code doesn't work.

1条回答
劫难
2楼-- · 2019-09-08 10:03

Looks like you're missing the schema attribute. Any autoform needs to take in a schema attribute that explicitly tells autoform to use that schema to generate the necessary form. Check this page out for demos using autoform.

{{> quickForm collection="theMongoCollection" id="theFormID" schema="theSchemaName" type="typeOfForm" }}
查看更多
登录 后发表回答