【发布时间】:2017-07-22 15:44:54
【问题描述】:
我为payments 集合和memberProfile 创建了两个单独的模式。现在我需要创建一个quickform,这样我就可以加载与唯一的 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
},
});
此代码不起作用。
【问题讨论】:
-
你的自动表单是什么样的?
-
我创建快速表单的代码是 {{> quickForm collection="MemberProfiles" id="insertMemberProfileForm" type="insert" }}
-
您好像缺少
schema属性?任何 autoform 都需要接受schema属性,该属性明确告诉 autoform 使用该模式来生成必要的表单。查看this page out 以获取使用 autoform 的演示。 -
谢谢 ....................
-
不确定这是否有助于您解决问题,我将发表我的评论作为答案。如果有帮助,你可以接受。
标签: meteor meteor-blaze meteor-autoform