{"action":"opened","issue":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1039","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1039/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1039/comments","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1039/events","html_url":"https://github.com/aldeed/meteor-autoform/issues/1039","id":88209455,"number":1039,"title":"specify scope for push array","user":{"login":"ganySA","id":3189206,"avatar_url":"https://avatars.githubusercontent.com/u/3189206?v=3","gravatar_id":"","url":"https://api.github.com/users/ganySA","html_url":"https://github.com/ganySA","followers_url":"https://api.github.com/users/ganySA/followers","following_url":"https://api.github.com/users/ganySA/following{/other_user}","gists_url":"https://api.github.com/users/ganySA/gists{/gist_id}","starred_url":"https://api.github.com/users/ganySA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ganySA/subscriptions","organizations_url":"https://api.github.com/users/ganySA/orgs","repos_url":"https://api.github.com/users/ganySA/repos","events_url":"https://api.github.com/users/ganySA/events{/privacy}","received_events_url":"https://api.github.com/users/ganySA/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-14T16:25:12Z","updated_at":"2015-06-14T16:25:12Z","closed_at":null,"body":"Hi\r\n\r\nI have been trying to debug the code that works for pusharrays - i dont know if i am doing something wrong but i cannot find anything in the docs that allows for setting the scope or index of a push array.\r\n\r\n    {{#autoForm id=\"updateArrayItemDemo\" type=\"update\"     collection=Collections.PeopleWithContacts doc=exampleDoc setArrayItems=true}}\r\n     {{> afQuickField name=\"contacts.2.name\"}}\r\n      {{> afQuickField name=\"contacts.2.phone\"}}\r\n      <div class=\"form-group\">\r\n        <button type=\"submit\" class=\"btn btn-primary\">Submit</button>\r\n        <button type=\"reset\" class=\"btn btn-default\">Reset Form</button>\r\n      </div>\r\n    {{/autoForm}}\r\n\r\nIs there anyways to set the index for the array 2 (above) using a variable?\r\n\r\nI have tried setting scope {[contacts.2}} but this doesnt work. I would like to know what is the best way to set the index for the array? \r\n\r\nI tried to modify the existing code for afFieldInput to\r\n\r\nif (self.hasOwnProperty('arrIndex'))\r\n    {\r\n        var arrCount = 0;\r\n        var intIndexOfMatch = self.name.indexOf(\"$\");\r\n\r\n        // Loop over the string value replacing out each matching\r\n        // substring.\r\n        while (intIndexOfMatch != -1) {\r\n            // Relace out the current instance.\r\n            self.name = self.name.replace('$', self.arrIndex[0]);\r\n            // Get the index of any next matching substring.\r\n            intIndexOfMatch = self.name.indexOf('$');\r\n            arrCount++;\r\n        }\r\n    }\r\n\r\nwhich would then allow me to do:\r\n\r\n     +afFieldInput name=\"services.$.description\" arrIndex=servId \r\n\r\n\r\n\r\n"}}