{"action":"created","issue":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/924","repository_url":"https://api.github.com/repos/aldeed/meteor-autoform","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/924/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/924/comments","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/924/events","html_url":"https://github.com/aldeed/meteor-autoform/issues/924","id":73056135,"number":924,"title":"Feature Request: Conditionally Hiding Fields from Schema Setup","user":{"login":"etyp","id":5808998,"avatar_url":"https://avatars.githubusercontent.com/u/5808998?v=3","gravatar_id":"","url":"https://api.github.com/users/etyp","html_url":"https://github.com/etyp","followers_url":"https://api.github.com/users/etyp/followers","following_url":"https://api.github.com/users/etyp/following{/other_user}","gists_url":"https://api.github.com/users/etyp/gists{/gist_id}","starred_url":"https://api.github.com/users/etyp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etyp/subscriptions","organizations_url":"https://api.github.com/users/etyp/orgs","repos_url":"https://api.github.com/users/etyp/repos","events_url":"https://api.github.com/users/etyp/events{/privacy}","received_events_url":"https://api.github.com/users/etyp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2015-05-04T15:46:22Z","updated_at":"2016-07-30T01:26:13Z","closed_at":null,"body":"I know there are ways to hide/show fields within custom templates using the `afFieldValueIs` helper, but this limits the conditional to just template logic.\r\n\r\nIdeally it would be nice to be able to define dependent hide/show options in the Schema. This would allow for conditionally hiding/showing fields when using `quickForm`.\r\n\r\nMaybe it could be defined like:\r\n\r\n```\r\n myField: {\r\n    label: 'My Field',\r\n    autoform: {\r\n        visible: function() {\r\n            // Grab value of another field to determine whether to show this field\r\n            // In this case, we return true if the 'otherField' value is also true\r\n            // (e.g. if 'otherField' is a checkbox and is checked, show 'myField')\r\n            var otherField = this.field(\"otherField\");\r\n            return otherField.value;\r\n        }\r\n    }\r\n  }),\r\n```\r\n\r\nWhere `this.field(...)` works in the same type of context that `autoValue` does.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/comments/236330668","html_url":"https://github.com/aldeed/meteor-autoform/issues/924#issuecomment-236330668","issue_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/924","id":236330668,"user":{"login":"juliomac","id":3759295,"avatar_url":"https://avatars.githubusercontent.com/u/3759295?v=3","gravatar_id":"","url":"https://api.github.com/users/juliomac","html_url":"https://github.com/juliomac","followers_url":"https://api.github.com/users/juliomac/followers","following_url":"https://api.github.com/users/juliomac/following{/other_user}","gists_url":"https://api.github.com/users/juliomac/gists{/gist_id}","starred_url":"https://api.github.com/users/juliomac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliomac/subscriptions","organizations_url":"https://api.github.com/users/juliomac/orgs","repos_url":"https://api.github.com/users/juliomac/repos","events_url":"https://api.github.com/users/juliomac/events{/privacy}","received_events_url":"https://api.github.com/users/juliomac/received_events","type":"User","site_admin":false},"created_at":"2016-07-30T01:26:13Z","updated_at":"2016-07-30T01:26:13Z","body":"+1, This could work in conjunction with optional. Instead of ``optional: true|false`` we could have ``optional: true|hide|false`` and use very same custom function. That would eliminate the risks @ChrisCinelli mentions. "}}
{"actor":{"display_login":"juliomac"}}