{"action":"created","issue":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/969","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/969/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/969/comments","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/969/events","html_url":"https://github.com/aldeed/meteor-autoform/issues/969","id":80585150,"number":969,"title":"Exception in template helper: Error: Invalid field name","user":{"login":"mchan75","id":12173421,"avatar_url":"https://avatars.githubusercontent.com/u/12173421?v=3","gravatar_id":"","url":"https://api.github.com/users/mchan75","html_url":"https://github.com/mchan75","followers_url":"https://api.github.com/users/mchan75/followers","following_url":"https://api.github.com/users/mchan75/following{/other_user}","gists_url":"https://api.github.com/users/mchan75/gists{/gist_id}","starred_url":"https://api.github.com/users/mchan75/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchan75/subscriptions","organizations_url":"https://api.github.com/users/mchan75/orgs","repos_url":"https://api.github.com/users/mchan75/repos","events_url":"https://api.github.com/users/mchan75/events{/privacy}","received_events_url":"https://api.github.com/users/mchan75/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-25T16:20:25Z","updated_at":"2015-05-26T20:02:06Z","closed_at":null,"body":"In reference to issue #802 I've followed the workaround provided by @abecks for Schema reactivity as I have almost the same use case in my Meteor project, where I need to dynamically change the schema in autoform as the schema to be loaded is dependent on the selection in a select box . Below the code I am using in my application. \r\n\r\nEven though when I try to switch schema it changes smoothly without any problem, and a new form is displayed but in the browser console when switching I get tons of errors as that shown below. Can you please tell me what I might be missing / doing wrong here? Thanks\r\n\r\n//Error\r\n\r\n    Exception in template helper: Error: Invalid field name: DateOfPurchase\r\n    at Object.getDefs (http://localhost:3000/packages/aldeed_autoform.js?2ffcea3a8ad7973ac5bdee51c024bdbbd450ae19:257:13)\r\n    at Object.autoFormGetComponentContext [as getComponentContext] (http://localhost:3000/packages/aldeed_autoform.js?2ffcea3a8ad7973ac5bdee51c024bdbbd450ae19:516:20)\r\n    at Object.afFormGroupContext (http://localhost:3000/packages/aldeed_autoform.js?2ffcea3a8ad7973ac5bdee51c024bdbbd450ae19:7130:30)\r\n    at bindDataContext (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2880:16)\r\n    at Blaze._wrapCatchingExceptions (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1651:16)\r\n    at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2928:66\r\n    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3476:12)\r\n    at wrapHelper (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2927:27)\r\n    at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?7bafbe05ec09b6bbb6a3b276537e4995ab298a2f:172:18)\r\n    at http://localhost:3000/packages/aldeed_autoform.js?2ffcea3a8ad7973ac5bdee51c024bdbbd450ae19:7097:23\r\n\r\n\r\n//JS\r\n\r\n    var destroyForm = new ReactiveVar(false);\r\n    var invoiceSchema = new ReactiveVar(null);\r\n\r\n      this.classTempArrayToJSON = function(classTempArray) {\r\n          var tempSchemaObj = {};\r\n          for(var i=0; i<classTempArray.length; i++){\r\n              if(classTempArray[i].fieldtype=='String'){\r\n                  tempSchemaObj[classTempArray[i].fieldname] = {  type: String,\r\n                                                                 label: classTempArray[i].fieldlbl,\r\n                                                                 min: Number(classTempArray[i].minval),\r\n                                                                 max: Number(classTempArray[i].maxval),\r\n                                                                 optional: !classTempArray[i].required };\r\n              }\r\n          }\r\n          return tempSchemaObj;\r\n      };\r\n\r\n     function getInvoiceSchema(selectedSchema){\r\n        var x = InvoiceTempCol.find().fetch();\r\n        if(x.length > 0){\r\n          var schema = classTempArrayToJSON(x[selectedSchema].fieldsList);\r\n          destroyForm.set(false);\r\n          return new SimpleSchema(schema);      \r\n        }else{\r\n          destroyForm.set(true);\r\n          return {};\r\n        }\r\n    }\r\n    Template.invoiceTemplate.created = function(){\r\n      invoiceSchema.set(getInvoiceSchema(9)); //Loading any invoice template on startup\r\n    };\r\n\r\n    Template.invoiceTemplate.helpers({\r\n      destroyForm: function(){\r\n        return destroyForm.get();\r\n      },\r\n      schema: function(){\r\n        return invoiceSchema.get();\r\n      }  \r\n    });\r\n\r\n\r\n\r\n//HTML\r\n\r\n        {{#if destroyForm}}\r\n            <h3>Invoice not loaded yet!</h3>\r\n        {{else}}\r\n            {{> quickForm id=\"invoiceForm\" buttonContent=\"Insert\" buttonClasses=\"btn btn-primary btn-sm\" schema=schema type=\"method\" meteormethod=\"saveInvoice\"}}\r\n        {{/if}}        \r\n"},"comment":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/comments/105649525","html_url":"https://github.com/aldeed/meteor-autoform/issues/969#issuecomment-105649525","issue_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/969","id":105649525,"user":{"login":"abecks","id":2068353,"avatar_url":"https://avatars.githubusercontent.com/u/2068353?v=3","gravatar_id":"","url":"https://api.github.com/users/abecks","html_url":"https://github.com/abecks","followers_url":"https://api.github.com/users/abecks/followers","following_url":"https://api.github.com/users/abecks/following{/other_user}","gists_url":"https://api.github.com/users/abecks/gists{/gist_id}","starred_url":"https://api.github.com/users/abecks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abecks/subscriptions","organizations_url":"https://api.github.com/users/abecks/orgs","repos_url":"https://api.github.com/users/abecks/repos","events_url":"https://api.github.com/users/abecks/events{/privacy}","received_events_url":"https://api.github.com/users/abecks/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T20:02:06Z","updated_at":"2015-05-26T20:02:06Z","body":"Yes, that has been my experience. I am currently using the workaround in a production app, and while it fires errors, the only real problem it is causing is filling my Kadira error logs up."}}