【问题标题】:load collections to a quickform in meteor将集合加载到流星中的快速表单
【发布时间】: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


【解决方案1】:

看起来您缺少架构属性。任何自动表单都需要接受一个模式属性,该属性明确告诉自动表单使用该模式来生成必要的表单。使用 autoform 查看 this page out 的演示。

{{> quickForm collection="theMongoCollection" id="theFormID" schema="theSchemaName" type="typeOfForm" }}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-03
    • 1970-01-01
    • 2016-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多