{"action":"closed","issue":{"url":"https://api.github.com/repos/erikras/redux-form/issues/3837","repository_url":"https://api.github.com/repos/erikras/redux-form","labels_url":"https://api.github.com/repos/erikras/redux-form/issues/3837/labels{/name}","comments_url":"https://api.github.com/repos/erikras/redux-form/issues/3837/comments","events_url":"https://api.github.com/repos/erikras/redux-form/issues/3837/events","html_url":"https://github.com/erikras/redux-form/issues/3837","id":297701053,"number":3837,"title":"right way to use Form and submit, no refresh","user":{"login":"webmobiles","id":21120559,"avatar_url":"https://avatars2.githubusercontent.com/u/21120559?v=4","gravatar_id":"","url":"https://api.github.com/users/webmobiles","html_url":"https://github.com/webmobiles","followers_url":"https://api.github.com/users/webmobiles/followers","following_url":"https://api.github.com/users/webmobiles/following{/other_user}","gists_url":"https://api.github.com/users/webmobiles/gists{/gist_id}","starred_url":"https://api.github.com/users/webmobiles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webmobiles/subscriptions","organizations_url":"https://api.github.com/users/webmobiles/orgs","repos_url":"https://api.github.com/users/webmobiles/repos","events_url":"https://api.github.com/users/webmobiles/events{/privacy}","received_events_url":"https://api.github.com/users/webmobiles/received_events","type":"User","site_admin":false},"labels":[{"id":242808388,"url":"https://api.github.com/repos/erikras/redux-form/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-16T07:28:30Z","updated_at":"2018-02-17T03:33:07Z","closed_at":"2018-02-17T03:33:07Z","author_association":"NONE","body":"I have just read a lot of issues in redux-form how to avoid refresh page on submit, but on docs is not clear. Until here i was using two components, the father to defined handleSubmit and pass to the children, but now I need to write a lot of forms in a single component, so is possible to do that?\r\n\r\nActually with this code i got refresh page, but no values is showed in handleSubmit()\r\n\r\nmy code:\r\n\r\n\r\n```\r\nimport React, { Component } from 'react';\r\nimport { transMsg as t } from '../../utils/commonutils';\r\nimport { Form, Field, reduxForm } from 'redux-form';\r\nimport { withRouter } from 'react-router';\r\nimport {\r\n  graphql,\r\n  compose,\r\n} from 'react-apollo';\r\nimport { connect } from 'react-redux';\r\n\r\nimport defQls from '../../defQls';\r\nimport {fieldsValidator, processError} from \"../../utils/helper\";\r\nimport FormField from \"../FormField\";\r\nimport {Tables} from \"../../defTables\";\r\n\r\nconst fields = {\r\n  oldpassword: {\r\n    validators: ['required', 'password'],\r\n  },\r\n  newpassword: {\r\n    validators: ['required', 'password'],\r\n  },\r\n  newpassword2: {\r\n    validators: ['required', 'password'],\r\n  },\r\n};\r\n\r\nconst validate = values => fieldsValidator(fields, values);\r\n\r\n\r\nclass ChangePass extends Component {\r\n\r\n  constructor(props) {\r\n    super(props);\r\n  }\r\n\r\n  handleSubmit = (values) => {\r\n    console.log('submit values',values);\r\n  };\r\n\r\n  render() {\r\n\r\n    const { error, pristine, invalid, reset, submitting, t } = this.props;\r\n    return (\r\n      <Form onSubmit={() => this.handleSubmit}>\r\n        <div className=\"formSection\" style={{ flexDirection: 'column' }}>\r\n          <Field\r\n            name=\"newpassword\"\r\n            typeInput=\"password\"\r\n            component={FormField}\r\n            label=\"login.newpassword\"\r\n          />\r\n          <div className=\"formRow\">\r\n            <div style={{ position: 'relative' }}>\r\n              <button type=\"submit\" disabled={submitting} style={{ paddingLeft: '35px' }}>\r\n                {t('form.update')}\r\n              </button>\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </Form>\r\n    );\r\n  }\r\n}\r\n\r\n\r\nconst ChangePassForm = reduxForm({\r\n  form: 'formChangePass',\r\n  validate,\r\n})(ChangePass);\r\n\r\n\r\nconst withRouterList = withRouter(ChangePassForm);\r\nconst withGraphqlandRouter = compose(\r\n\r\n  graphql(defQls.changePass, {\r\n    name: 'changePass',\r\n    options: props => {\r\n      const optionsValues = { variables: {id: props.match.params.id } };\r\n      optionsValues.fetchPolicy = 'network-only';\r\n      return optionsValues ;\r\n    },\r\n  }),\r\n)(withRouterList);\r\n\r\n\r\nconst mapStateToProps = (state) => {\r\n  return {\r\n    myState: state,\r\n  };\r\n};\r\n\r\nconst ComponentFull = connect(\r\n  mapStateToProps ,\r\n  {\r\n  },\r\n)(withGraphqlandRouter);\r\n\r\nexport default ComponentFull;\r\n\r\n```"}}
{"actor":{"display_login":"gustavohenke"}}