load collections to a quickform in meteor

安稳与你 提交于 2019-12-25 08:42:37

问题


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:


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" }}


来源:https://stackoverflow.com/questions/42563507/load-collections-to-a-quickform-in-meteor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!