{"action":"opened","issue":{"url":"https://api.github.com/repos/erikras/redux-form/issues/2923","repository_url":"https://api.github.com/repos/erikras/redux-form","labels_url":"https://api.github.com/repos/erikras/redux-form/issues/2923/labels{/name}","comments_url":"https://api.github.com/repos/erikras/redux-form/issues/2923/comments","events_url":"https://api.github.com/repos/erikras/redux-form/issues/2923/events","html_url":"https://github.com/erikras/redux-form/issues/2923","id":228307224,"number":2923,"title":"Provide validating flag to know when form is validating","user":{"login":"chris-verclytte","id":1611574,"avatar_url":"https://avatars1.githubusercontent.com/u/1611574?v=3","gravatar_id":"","url":"https://api.github.com/users/chris-verclytte","html_url":"https://github.com/chris-verclytte","followers_url":"https://api.github.com/users/chris-verclytte/followers","following_url":"https://api.github.com/users/chris-verclytte/following{/other_user}","gists_url":"https://api.github.com/users/chris-verclytte/gists{/gist_id}","starred_url":"https://api.github.com/users/chris-verclytte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chris-verclytte/subscriptions","organizations_url":"https://api.github.com/users/chris-verclytte/orgs","repos_url":"https://api.github.com/users/chris-verclytte/repos","events_url":"https://api.github.com/users/chris-verclytte/events{/privacy}","received_events_url":"https://api.github.com/users/chris-verclytte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-12T14:22:14Z","updated_at":"2017-05-12T14:22:14Z","closed_at":null,"body":"### Are you submitting a **bug report** or a **feature request**?\r\nFeature request\r\n\r\n### What is the current behavior?\r\nActually, we don't have the knowledge of redux-form being validating the form. It can be a lack in some use case.\r\nFor example, I am currently using a form that I want uncoupled from the component it is called from, thus I am having a classical form nested in another component that contains submit button and that also *need to submit the form automatically when form is valid*.\r\nThus this parent component has a componentDidUpdate function as following:\r\n```\r\nif (!this.props.pristine && this.props.valid && !this.props.submitting)\r\n {\r\n      this.props.submit();\r\n    }\r\n```\r\nThe problem is that this parent component is binded to redux through connect (from react-redux) in order to use action creators and selectors. And thus when a field changes in the form, it will trigger a re-render of the parent component as soon as CHANGE action is dispatched and then trigger again when UPDATE_SYNC_ERRORS is dispatched (see picture for order of action).\r\nThat means that after CHANGE being dispatched, parent will have:\r\n- pristine to false as there was a change\r\n- submitting to false as it is not yet submitting\r\n- BUT valid to true as it was valid before change and UPDATE_SYNC_ERRORS has not yet been dispatched\r\n\r\nThus, it will trigger a submit bypassing validation and I have no flag that I can use to wait validation to be done.\r\n\r\n### What is the expected behavior?\r\nThen, I find it would be great that actions triggering a validation set a flag like validating (in the same way that submitting is working).\r\nIn this way it would allow something like this to be done:\r\n```\r\nif (!this.props.pristine && this.props.valid && !this.props.submitting && !this.props.validating)\r\n {\r\n      this.props.submit();\r\n    }\r\n```  \r\n\r\nWhat do you think about that ? \r\n"}}
{"actor":{"display_login":"chris-verclytte"}}