{"action":"created","issue":{"url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/15","repository_url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator","labels_url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/15/comments","events_url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/15/events","html_url":"https://github.com/MichaelCereda/react-native-form-generator/pull/15","id":162058639,"number":15,"title":"Allow form validation","user":{"login":"gwmccull","id":580060,"avatar_url":"https://avatars.githubusercontent.com/u/580060?v=3","gravatar_id":"","url":"https://api.github.com/users/gwmccull","html_url":"https://github.com/gwmccull","followers_url":"https://api.github.com/users/gwmccull/followers","following_url":"https://api.github.com/users/gwmccull/following{/other_user}","gists_url":"https://api.github.com/users/gwmccull/gists{/gist_id}","starred_url":"https://api.github.com/users/gwmccull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwmccull/subscriptions","organizations_url":"https://api.github.com/users/gwmccull/orgs","repos_url":"https://api.github.com/users/gwmccull/repos","events_url":"https://api.github.com/users/gwmccull/events{/privacy}","received_events_url":"https://api.github.com/users/gwmccull/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-24T01:34:56Z","updated_at":"2016-06-26T14:33:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/pulls/15","html_url":"https://github.com/MichaelCereda/react-native-form-generator/pull/15","diff_url":"https://github.com/MichaelCereda/react-native-form-generator/pull/15.diff","patch_url":"https://github.com/MichaelCereda/react-native-form-generator/pull/15.patch"},"body":"This is a pull request to allow forms and inputs to state if they are valid or not (InputComponents already had this ability but the InputFields were not passing the info through).\r\n\r\nTo accomplish this, I made sure the refs were getting set and passed through correctly (so that we can access the child components).  Then I created a `valid` property on the form and InputField.  Each time the change handler is triggered, a parent component checks it child or children to see if they are valid or not and sets its own `valid` property.  The value change is then propagated up to the parent.\r\n\r\nThe form has to collapse the valid properties of all of its children into one value.  When reviewing the `valid` property of each child, I assumed that `true` and `false` are pretty self evident, but that `undefined` means the child doesn't know.  Therefore, any child with a `false` sets the form's `valid` property to `false`.  If there are no falses, any child with an `undefined` sets the form's `valid` property to `undefined`.  The form's `valid` property is only set to `true`, if and only if, all children have a `valid` property of `true`.\r\n\r\nCollapsing the form children in this way allows the form handler to decide what to do in each situation."},"comment":{"url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/comments/228604166","html_url":"https://github.com/MichaelCereda/react-native-form-generator/pull/15#issuecomment-228604166","issue_url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/15","id":228604166,"user":{"login":"MichaelCereda","id":107390,"avatar_url":"https://avatars.githubusercontent.com/u/107390?v=3","gravatar_id":"","url":"https://api.github.com/users/MichaelCereda","html_url":"https://github.com/MichaelCereda","followers_url":"https://api.github.com/users/MichaelCereda/followers","following_url":"https://api.github.com/users/MichaelCereda/following{/other_user}","gists_url":"https://api.github.com/users/MichaelCereda/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelCereda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelCereda/subscriptions","organizations_url":"https://api.github.com/users/MichaelCereda/orgs","repos_url":"https://api.github.com/users/MichaelCereda/repos","events_url":"https://api.github.com/users/MichaelCereda/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelCereda/received_events","type":"User","site_admin":false},"created_at":"2016-06-26T14:33:46Z","updated_at":"2016-06-26T14:33:46Z","body":"Please check this branch https://github.com/MichaelCereda/react-native-form-generator/blob/form-validation/examples/FormView.js\r\n\r\nNow validation works even with multiple validators and all the behavior can be defined without altering the component."}}
{"actor":{"display_login":"MichaelCereda"}}