{"action":"created","issue":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/210","repository_url":"https://api.github.com/repos/aldeed/meteor-autoform","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/210/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/210/comments","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/210/events","html_url":"https://github.com/aldeed/meteor-autoform/issues/210","id":35591559,"number":210,"title":"How to pass a default value for a field in 'insert' form?","user":{"login":"a-ruzin","id":4249372,"avatar_url":"https://avatars.githubusercontent.com/u/4249372?v=3","gravatar_id":"","url":"https://api.github.com/users/a-ruzin","html_url":"https://github.com/a-ruzin","followers_url":"https://api.github.com/users/a-ruzin/followers","following_url":"https://api.github.com/users/a-ruzin/following{/other_user}","gists_url":"https://api.github.com/users/a-ruzin/gists{/gist_id}","starred_url":"https://api.github.com/users/a-ruzin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-ruzin/subscriptions","organizations_url":"https://api.github.com/users/a-ruzin/orgs","repos_url":"https://api.github.com/users/a-ruzin/repos","events_url":"https://api.github.com/users/a-ruzin/events{/privacy}","received_events_url":"https://api.github.com/users/a-ruzin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-06-12T14:55:17Z","updated_at":"2016-02-05T09:22:25Z","closed_at":"2014-06-12T15:31:21Z","body":"How to pass a default value for a field in 'insert' form?\r\n\r\nMy process is:\r\n1. A User selects some value in a list on a page, then\r\n2. The 'insert' from opens, and I want that one field to be initialized with the value the user choosed on a previous step.\r\n\r\nCan't figure out how to pass a parameter withing URL (or any other way).\r\nThe problem is how to initialize form with the value.\r\n\r\nSuppose I have an URL:\r\n\r\nhttp://localhost:3000/activity/new/Sport\r\n\r\n===============\r\nrouter.js:\r\n```javascript\r\n...\r\nRouter.map(function () {\r\n    ...\r\n    this.route('newActivity', {\r\n        path: '/activity/new/:tag',\r\n        data: function() {\r\n            Session.set('tag', this.params.tag);\r\n            return null;\r\n        }\r\n    });\r\n    ...\r\n```\r\n\r\n===============\r\nmodels/activity.js\r\n```javascript\r\n...\r\nActivities = new Meteor.Collection(\"activities\", {\r\n    schema: {\r\n        title: {\r\n            type: String,\r\n            label: 'название'\r\n        },\r\n        ...\r\n        tag: {\r\n            type: String,\r\n            label: 'тэг'\r\n        }\r\n    }\r\n});\r\n```\r\n\r\n================\r\ntemplates/avtibity.js\r\n```javascript\r\n...\r\nTemplate.newActivity.helpers({\r\n    defaultTag: function() {\r\n        return Session.get('tag');\r\n    }\r\n});\r\n...\r\n```\r\n\r\n================\r\ntemplates/activity.html\r\n```html\r\n...\r\n<template name=\"newActivity\">\r\n    <h1>Create new Activity!</h1>\r\n    {{#autoForm collection=\"Activities\" id=\"insertActivityForm\" type=\"insert\"}}\r\n        {{> afQuickField name=\"title\"}}\r\n        ...\r\n        {{> afQuickField name=\"tag\" value=\"   ??????    \"}} // ? {{defaultTag}}\r\n        ho ho ho {{defaultTag}}\r\n    {{/autoForm}}\r\n</template>\r\n```\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/comments/180264037","html_url":"https://github.com/aldeed/meteor-autoform/issues/210#issuecomment-180264037","issue_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/210","id":180264037,"user":{"login":"srinivasdamam","id":13461208,"avatar_url":"https://avatars.githubusercontent.com/u/13461208?v=3","gravatar_id":"","url":"https://api.github.com/users/srinivasdamam","html_url":"https://github.com/srinivasdamam","followers_url":"https://api.github.com/users/srinivasdamam/followers","following_url":"https://api.github.com/users/srinivasdamam/following{/other_user}","gists_url":"https://api.github.com/users/srinivasdamam/gists{/gist_id}","starred_url":"https://api.github.com/users/srinivasdamam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srinivasdamam/subscriptions","organizations_url":"https://api.github.com/users/srinivasdamam/orgs","repos_url":"https://api.github.com/users/srinivasdamam/repos","events_url":"https://api.github.com/users/srinivasdamam/events{/privacy}","received_events_url":"https://api.github.com/users/srinivasdamam/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T09:22:25Z","updated_at":"2016-02-05T09:22:25Z","body":"@aldeed  thanks for the above solution."}}