{"action":"opened","issue":{"url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/88","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/88/labels{/name}","comments_url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/88/comments","events_url":"https://api.github.com/repos/MichaelCereda/react-native-form-generator/issues/88/events","html_url":"https://github.com/MichaelCereda/react-native-form-generator/issues/88","id":194116143,"number":88,"title":"errorText field in addition to helpText","user":{"login":"peacechen","id":6295083,"avatar_url":"https://avatars.githubusercontent.com/u/6295083?v=3","gravatar_id":"","url":"https://api.github.com/users/peacechen","html_url":"https://github.com/peacechen","followers_url":"https://api.github.com/users/peacechen/followers","following_url":"https://api.github.com/users/peacechen/following{/other_user}","gists_url":"https://api.github.com/users/peacechen/gists{/gist_id}","starred_url":"https://api.github.com/users/peacechen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peacechen/subscriptions","organizations_url":"https://api.github.com/users/peacechen/orgs","repos_url":"https://api.github.com/users/peacechen/repos","events_url":"https://api.github.com/users/peacechen/events{/privacy}","received_events_url":"https://api.github.com/users/peacechen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-07T17:38:15Z","updated_at":"2016-12-07T17:38:15Z","closed_at":null,"body":"The helpText field can be leveraged to show an error message for input validation, as shown in the examples.  However this results in a lot of boilerplate code, particularly when every input shows input validation errors.  This code is repeated N times for N inputs:\r\n\r\n```\r\n\thelpText={ ((self)=>{\r\n\t\tif(Object.keys(self.refs).length !== 0){\r\n\t\t\tif(!self.refs.checkoutForm.refs.first_name.valid){\r\n\t\t\t\treturn self.refs.checkoutForm.refs.first_name.validationErrors.join(\"\\n\");\r\n\t\t\t}\r\n\t\t}\r\n\t})(this)}\r\n```\r\n\r\nWe could reduce this boilerplate by introducing an _errorText_ field that automatically does the above check on the _valid_ field and displays _errorText_ accordingly.\r\n"}}
{"actor":{"display_login":"peacechen"}}