{"action":"created","issue":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/877","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/877/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/877/comments","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/877/events","html_url":"https://github.com/aldeed/meteor-autoform/issues/877","id":67867731,"number":877,"title":"Issue found when calling AutoForm.getFieldValue","user":{"login":"aadamsx","id":5341158,"avatar_url":"https://avatars.githubusercontent.com/u/5341158?v=3","gravatar_id":"","url":"https://api.github.com/users/aadamsx","html_url":"https://github.com/aadamsx","followers_url":"https://api.github.com/users/aadamsx/followers","following_url":"https://api.github.com/users/aadamsx/following{/other_user}","gists_url":"https://api.github.com/users/aadamsx/gists{/gist_id}","starred_url":"https://api.github.com/users/aadamsx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aadamsx/subscriptions","organizations_url":"https://api.github.com/users/aadamsx/orgs","repos_url":"https://api.github.com/users/aadamsx/repos","events_url":"https://api.github.com/users/aadamsx/events{/privacy}","received_events_url":"https://api.github.com/users/aadamsx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-12T03:48:52Z","updated_at":"2015-05-20T16:00:37Z","closed_at":null,"body":"This issue is probably not with AutoForm.getFieldValue, but I suspect with how I'm setting my form for inserts and updates.\r\n\r\nUp until 5.0 everything has worked fine.\r\n\r\nHere's the error I'm getting when trying to call AutoForm.getFieldValue:\r\n\r\n```\r\nError: No form with ID MY_FORM_NAME is currently rendered. If this call originated from within a template event or helper, you should call without passing a formId to avoid seeing this error\r\n```\r\n\r\nI'm sure you've seen this before, but here's how I'm setting the form mode:\r\n\r\n1) I check if I have a record in the DB for that form and user,\r\n```\r\n  if (count === 0)\r\n    return {doc: null, type: \"insert\"};\r\n  else\r\n    return {doc: dataSet, type: \"update\"};\r\n```\r\nIf I do then I set the type to update with the data, else insert with doc: null.  The dataSet is just a return value from,\r\n```return MY_COLLECTION.findOne({_personId: Meteor.userId()});```\r\n\r\n2) The above code is called within a helper on the form template,\r\n```\r\nmy_form_Controller.helpers({\r\n  setFormMode: function () {\r\n    return getFormMode(this.MY_FORM_NAME());\r\n  }\r\n});\r\n```\r\n3) Then within the template, I have a ```{{#with setFormMode}}```, and within this I set the form attributes like so,\r\n```\r\n{{#autoForm collection=\"MY_COLLECTION\" id=\"MY_FORM_NAME\" doc=doc type=type class=\"form-horizontal\" }}\r\n```\r\n\r\n----\r\nThe error occurs when I call a ```AutoForm.getFieldValue(fieldName, MY_FORM_NAME)``` when the form is loading and the controls are being placed on the form....\r\n\r\nWhat is seems like is that the form is not rendered before the call to ```getFieldValue()```.  Again, this all worked fine before the upgrade from 4.0.2 to 5.1.2."},"comment":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/comments/103938611","html_url":"https://github.com/aldeed/meteor-autoform/issues/877#issuecomment-103938611","issue_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/877","id":103938611,"user":{"login":"aadamsx","id":5341158,"avatar_url":"https://avatars.githubusercontent.com/u/5341158?v=3","gravatar_id":"","url":"https://api.github.com/users/aadamsx","html_url":"https://github.com/aadamsx","followers_url":"https://api.github.com/users/aadamsx/followers","following_url":"https://api.github.com/users/aadamsx/following{/other_user}","gists_url":"https://api.github.com/users/aadamsx/gists{/gist_id}","starred_url":"https://api.github.com/users/aadamsx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aadamsx/subscriptions","organizations_url":"https://api.github.com/users/aadamsx/orgs","repos_url":"https://api.github.com/users/aadamsx/repos","events_url":"https://api.github.com/users/aadamsx/events{/privacy}","received_events_url":"https://api.github.com/users/aadamsx/received_events","type":"User","site_admin":false},"created_at":"2015-05-20T16:00:37Z","updated_at":"2015-05-20T16:00:37Z","body":"Well, I'll try to sum up what I think is going on:\r\n\r\nI'm using a template that has a schema and collection attached to it (using Autoform and SimpleSchemas and Collection2).  This template has child or sub templates that contain the afFieldsInput templates.  Inside these child templates I have logic that calls out to AutoForm.getFieldValue.  \r\n\r\nSome of these afFields are radio buttons and some are checkboxes.  Everything worked great until I updated.  Now a few things are happening.  The radio buttons, where I have show/hide logic that calls out to getFieldValues, no longer works, and the checkboxes no longer works -- they are no longer reactive.\r\n\r\nI've gotten around this by implementing my own reactivity, thereby removing my dependency on getFieldValue for getting form data and reactivity.  Now my forms function find as far as I can tell.\r\n\r\nIf you post a repo where I can reproduce your situation, I'll take a look and try to help you.  Also, check out forums.meteor.com -- someone might be able to help you there too.  But in general, being able to create a github repo of your issue will help others help you.\r\n\r\nRant:\r\n------\r\nEventually I want to remove autoform, simple schema, and collection 2 altogether -- and implement my own forms, with reactive validation on the client.  Why would I go through this trouble?  Because I've gotten burned by this and its related package so many times now, I can't put my trust in it any longer.  Every time I upgrade meteor I worry that autoform is going to break again.  \r\n\r\nAnd with almost every upgrade of autoform, something gets fixed, and then something else breaks -- It's a ride I want to get off of, and really not worth the added upfront time savings IMO.\r\n\r\nAlso, at this point I think aldeed considers this package someone done from what I've read from him.  He's probably just busy, but he's stop responding to my and other's posts.  The problem with that is, I can't build software on a package that has major bugs, where PR are ignored (again probably busy), and doesn't respond to queries.  The guy is just stretch too thin with all the packages he maintains, not to mention the business he runs. \r\n\r\nIt's simple enough to build out our own controls, reactive validation, hooks, etc., it will just take a little longer to get going is all.\r\n"}}