Template helper not invoked on update aldeed autoform

132 views Asked by At

I am using meteoric-autoform and doing an update to my values, The form is not getting populated with existing values and also the update is not happening. I could also see that the template helper method that I have for fetching the id is not getting invoked at all.

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>
1

There are 1 answers

0
halbgut On

As you can see in the docs, update forms require a doc attribute.

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