{"action":"created","issue":{"url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/120","labels_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/120/comments","events_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/120/events","html_url":"https://github.com/christianalfoni/formsy-react/issues/120","id":74120232,"number":120,"title":"Nesting forms, complex data structures","user":{"login":"ivome","id":6703744,"avatar_url":"https://avatars.githubusercontent.com/u/6703744?v=3","gravatar_id":"","url":"https://api.github.com/users/ivome","html_url":"https://github.com/ivome","followers_url":"https://api.github.com/users/ivome/followers","following_url":"https://api.github.com/users/ivome/following{/other_user}","gists_url":"https://api.github.com/users/ivome/gists{/gist_id}","starred_url":"https://api.github.com/users/ivome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivome/subscriptions","organizations_url":"https://api.github.com/users/ivome/orgs","repos_url":"https://api.github.com/users/ivome/repos","events_url":"https://api.github.com/users/ivome/events{/privacy}","received_events_url":"https://api.github.com/users/ivome/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-07T20:37:41Z","updated_at":"2015-05-22T08:28:22Z","closed_at":null,"body":"I was wondering if there is a possibility of nesting forms to create complex data structures or if there is an easy way to implement that?\r\n\r\nIf the Form itself would implement the same interface as the Form element, we could nest them indefinitely and create complex hierarchical data structures with validation. Or maybe creating a special Input field is the way to go...\r\n\r\nI tried around a little bit with creating my own Input element with sub elements, but that does not work because I don't have access to the validation rules in an external component. \r\nFor now I created a mapping function which can handle names like entity[property] and returns the value correctly, but that is not as nice, because all the nodes have to be inside the main form component. Also I cannot add validation rules and a sub form, like when I want to make a complete address required. \r\nWhen trying to create reusable form partials I get the error: \r\nUncaught Error: Form Mixin requires component to be nested in a Form\r\n\r\nI was thinking about something like that (simplified draft): \r\n\r\nFirst create reusable form:\r\n```js\r\nvar AddressForm = React.createClass({\r\n[...]\r\nrender: function(){\r\n    return (\r\n        <Formsy.Form {...this.props}>\r\n             <input name=\"street\"/>\r\n             <input name=\"zip\"/>\r\n             <input name=\"city\"/>\r\n        </Formsy.Form>\r\n    ); \r\n}\r\n});\r\n```\r\n\r\nAnd then reuse that form as a field:\r\n```js\r\n <Formsy.Form>\r\n   <input name=\"name\"/>\r\n   <input name=\"otherProperty\"/>\r\n   <AddressForm name=\"address\"/>\r\n</Formsy.Form>\r\n```\r\n\r\nBasically what I am trying to get from the form as a value is a complex data structure like that: \r\n```js\r\n{\r\n    name: 'Someclient',\r\n    otherProperty: 123,\r\n    address: {\r\n        street: 'xyz',\r\n        zip: 'xyz',\r\n        city: 'xyz'\r\n    }\r\n}\r\n```\r\n\r\nAny thoughts on what's the best way to approach that? I think it would be a really great feature, I'd be happy to help implementing. "},"comment":{"url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/comments/104567227","html_url":"https://github.com/christianalfoni/formsy-react/issues/120#issuecomment-104567227","issue_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/120","id":104567227,"user":{"login":"LeoIannacone","id":1774748,"avatar_url":"https://avatars.githubusercontent.com/u/1774748?v=3","gravatar_id":"","url":"https://api.github.com/users/LeoIannacone","html_url":"https://github.com/LeoIannacone","followers_url":"https://api.github.com/users/LeoIannacone/followers","following_url":"https://api.github.com/users/LeoIannacone/following{/other_user}","gists_url":"https://api.github.com/users/LeoIannacone/gists{/gist_id}","starred_url":"https://api.github.com/users/LeoIannacone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeoIannacone/subscriptions","organizations_url":"https://api.github.com/users/LeoIannacone/orgs","repos_url":"https://api.github.com/users/LeoIannacone/repos","events_url":"https://api.github.com/users/LeoIannacone/events{/privacy}","received_events_url":"https://api.github.com/users/LeoIannacone/received_events","type":"User","site_admin":false},"created_at":"2015-05-22T08:28:22Z","updated_at":"2015-05-22T08:28:22Z","body":"Thank @ntucker !\r\n\r\n@christianalfoni can you please look at it? nesting forms are really useful in many many scenario..."}}