{"action":"created","issue":{"url":"https://api.github.com/repos/erikras/redux-form/issues/1679","repository_url":"https://api.github.com/repos/erikras/redux-form","labels_url":"https://api.github.com/repos/erikras/redux-form/issues/1679/labels{/name}","comments_url":"https://api.github.com/repos/erikras/redux-form/issues/1679/comments","events_url":"https://api.github.com/repos/erikras/redux-form/issues/1679/events","html_url":"https://github.com/erikras/redux-form/issues/1679","id":174603719,"number":1679,"title":"Programmatically submit a form from outside the form component","user":{"login":"mschipperheyn","id":384959,"avatar_url":"https://avatars.githubusercontent.com/u/384959?v=3","gravatar_id":"","url":"https://api.github.com/users/mschipperheyn","html_url":"https://github.com/mschipperheyn","followers_url":"https://api.github.com/users/mschipperheyn/followers","following_url":"https://api.github.com/users/mschipperheyn/following{/other_user}","gists_url":"https://api.github.com/users/mschipperheyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mschipperheyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mschipperheyn/subscriptions","organizations_url":"https://api.github.com/users/mschipperheyn/orgs","repos_url":"https://api.github.com/users/mschipperheyn/repos","events_url":"https://api.github.com/users/mschipperheyn/events{/privacy}","received_events_url":"https://api.github.com/users/mschipperheyn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-01T19:18:24Z","updated_at":"2016-09-02T21:53:07Z","closed_at":null,"body":"I generally abstract my forms into a form component. However, a number of forms that we use, have the submit button designed in the header, which is outside of the form screen in a parallel render branch.\r\n\r\nSo, I have been wondering how to implement a programmatic submit. I was thinking of the following:\r\n\r\n1. create a programmatic submit property in a reducer, that when true, leads to the execution of a programmatic submit in the form component, after which it's immediately set to false.\r\n2. using refs. In my case, the components are simply \"too far away from eachother\" for this to be feasible.\r\n\r\nAny suggestions on the best way to approach this? Ideally, I would be able to just call a redux-form action creator with the form name to submit the form."},"comment":{"url":"https://api.github.com/repos/erikras/redux-form/issues/comments/244496084","html_url":"https://github.com/erikras/redux-form/issues/1679#issuecomment-244496084","issue_url":"https://api.github.com/repos/erikras/redux-form/issues/1679","id":244496084,"user":{"login":"mschipperheyn","id":384959,"avatar_url":"https://avatars.githubusercontent.com/u/384959?v=3","gravatar_id":"","url":"https://api.github.com/users/mschipperheyn","html_url":"https://github.com/mschipperheyn","followers_url":"https://api.github.com/users/mschipperheyn/followers","following_url":"https://api.github.com/users/mschipperheyn/following{/other_user}","gists_url":"https://api.github.com/users/mschipperheyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mschipperheyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mschipperheyn/subscriptions","organizations_url":"https://api.github.com/users/mschipperheyn/orgs","repos_url":"https://api.github.com/users/mschipperheyn/repos","events_url":"https://api.github.com/users/mschipperheyn/events{/privacy}","received_events_url":"https://api.github.com/users/mschipperheyn/received_events","type":"User","site_admin":false},"created_at":"2016-09-02T21:53:07Z","updated_at":"2016-09-02T21:53:07Z","body":"This was a bit more difficult than expected and the solution is not all that elegant, although it seems to work ok.\r\n\r\nhttps://github.com/reactjs/react-redux/issues/376 got in the way of getting access to the submit method inside the form from the container component, which my initial attempt since the all the connect/reducer stuff is in the container component. \r\n\r\nSo, I solved it by putting a submitThis property on the form component itself combined with the already discussed reducer flag for this. \r\n\r\n"}}
{"actor":{"display_login":"mschipperheyn"}}