Help with updating form

Hello,

I have a collection that handles default values for forms. I need to build a UI to update the default values themselves, instead of force updating via mongo backend.

I’ve used aldeed’s update-each functionality. The data is being fetched from the DB and displayed in the table. However, when I try to update by inputting new values in the textbox, it does not persist. In fact, it keeps throwing this error which i’m not aware of.

Exception in template helper: TypeError: Cannot read property 'namedContext' of undefined
    at Object.autoFormFieldIsInvalid 

As a sample, here is what I’m working with:

Mongo Collection:

meteor:PRIMARY> db.testCollection.find()
{ "_id" : ObjectId("577ccd87f57f43d790c3ec49"), "schemaName" : "test_schema", "label" : "test_lable", "value" : "test_value" }

Schema:

test_schema = new SimpleSchema({
    "schemaName": {
        type: String,
    },
    "label": {
        type: String,
    },
    "value": {
        type: String,
    }
});

testCollection.attachSchema(test_schema);

Template:

<template name = "testTemplate">

<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <td style="width: 85px">Schema Name</td>
        <td style="width: 85px">Label</td>
      <td>Default Value</td>
      <td style="width: 250px">New Default Value</td>
    </tr>
  </thead>
  <tbody>
    {{#each items}}
      <tr>
        <td>{{this.schemaName}}</td>
        <td>{{this.label}}</td>
        <td>{{this.value}}</td>
        <td>
        {{#autoForm id=updateDefaiultsID type="update" collection=testCollection doc=this autosave=true}}
          {{> afFormGroup name="value" label=false}}
        {{/autoForm}}
        </td>
      </tr>
    {{/each}}
  </tbody>
</table>


</template>

Helper

import { Template } from 'meteor/templating';
import '../templates/testTemplate.html';


if (Meteor.isServer) {

  Meteor.publish(null, function () {
    return testCollection.find();
  });

  testCollection.allow({
    update: function () {
      return true;
    }
  });
}

else if (Meteor.isClient) {

  Template["testTemplate"].helpers({
    items: function () {
      return testCollection.find({}, {sort: {name: 1}});
    },
    updateDefaiultsID: function () {
      return "testTemplate" + this._id;
    }
  });

}

(Tagging @hwillson)