【问题标题】:Template helper not invoked on update aldeed autoform在更新自动生成时未调用模板助手
【发布时间】:2015-08-31 21:48:57
【问题描述】:

我正在使用 meteoric-autoform 并更新我的值,该表单没有填充现有值,并且更新也没有发生。 我还可以看到我用于获取 id 的模板辅助方法根本没有被调用。

assesmentEdit.js

Template.assesmentEdit.helpers({
  assesment: function () {
      alert("entered helper");
      console.log(template.data.id);
    var template = Template.instance();
    return Assesments.findOne({_id: template.data.id});
  }
});

assesmentEdit.html

<template name="assesmentEdit">
  {{#ionModal customTemplate=true}}
    {{# autoForm collection="Assesments" id="assesments-edit-form" type="update"}}
      <div class="bar bar-header bar-stable">
        <button data-dismiss="modal" type="button" class="button button-clear">Cancel</button>
        <h2 class="title">Edit Assesment</h2>
        <button type="submit" class="button button-positive button-clear">Save</button>
      </div>
      <div class="content has-header overflow-scroll">
        {{> afQuickField name="name" }}
        {{> afQuickField name="email"}}
        {{> afQuickField name="category"}}
        {{> afQuickField name="location"}}
      </div>
    {{/autoForm}}
  {{/ionModal}}
</template>

【问题讨论】:

    标签: meteor meteor-autoform meteoric


    【解决方案1】:

    如您所见,in the docsupdate 表单需要 doc 属性。

    {{# autoForm doc=assesment collection="Assesments" id="assesments-edit-form" type="update"}}
    

    【讨论】:

      猜你喜欢
      • 2015-08-23
      • 1970-01-01
      • 2015-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-26
      • 2015-01-15
      • 2019-12-02
      相关资源
      最近更新 更多