title: Redux-form get event in submit handler function
body: <p>Next to my redux forms I've a small sidebar with form names to switch between different forms. To keep the app state updated anytime when a user switch between these forms via the sidebar I do a submission of the current form state via the redux-form handleSubmit function. The submission is fired with a dispatch which updates the app state. This works fine but to make the clicked form visible I need to change the 'active' value in my state to the name of the form, this name is set on the list item in the sidebar items loop as a classname.</p>
  
  <p>I tried to receive the clicked element classname via event.target.className but it seems to have no results as event seems not to be the event I expected. How can I access the event in a handleSubmit mission to change the active form with the clicked className of list item of the sidebar?</p>
  
  <p><em>p.s. I will create a separated function, if / else statement or something else for this saveData function as I know the event.target.className won't be correct if the form would be submitted by the form button itself.</em></p>
  
  <p><strong>Example code</strong> </p>
  
  <pre><code>... some form field code
  
  class ComponentName extends React.Component {
  
      constructor(props) {
          super(props);
  
          this.state = {
              someName : this.props.someName,
          }
  
          this.saveData = this.saveData.bind(this);
      }
  
      saveData(values, dispatch) {
  
          let newState = {
              SomeName : update(this.state.someName, {
                  active : {
                      $set : this.state.active &lt;======= event.target.className ?
                  },
                  rows : {
                      data : {
                          $set : values.rows
                      }
                  }
              })
          }
  
          this.setState(newState);
  
          dispatch(someActionNAme(newState.someName));
  
      }
  
  
      render() {
  
          const { handleSubmit, submitting } = this.props;
  
          var items = {}
          Object.values(this.state.someName).map(function(item, i) {
              if (typeof item == 'object' &amp;&amp; item !== 'undefined' &amp;&amp; item !== null) {
                  items[i] = item;
              }
          })
  
          return (
              &lt;div className="someName__form"&gt;
  
                  &lt;form onSubmit={handleSubmit(this.saveData)}&gt;
  
                      &lt;ul className="someName__sidebar"&gt;
                          { Object.keys(items).map((item, i) =&gt; (
                                  &lt;li
                                      key={i}
                                      data-id={i}
                                      onClick={handleSubmit(this.saveData)}
                                      id={items[item].meta.name}
                                      className={items[item].meta.name}
                                      data-sort={items[item].meta.sort}
                                  &gt;
  
                                      {items[item].meta.label}
  
                                      {this.state.someName.active == items[item].meta.name &amp;&amp;
                                      &lt;b&gt;
                                          &amp;nbsp; [Active]
                                      &lt;/b&gt;
                                      }
  
                                  &lt;/li&gt;
                              )
                          )}
                      &lt;/ul&gt;
  
                      &lt;FieldArray name="rows" component={renderRows} /&gt;
  
                      &lt;div&gt;
                          &lt;button id="button" type="submit" disabled={submitting} onClick={handleSubmit(this.saveData)}&gt;
                              Save
                          &lt;/button&gt;
                      &lt;/div&gt;
  
                  &lt;/form&gt;
  
  
              &lt;/div&gt;
          )
  
      }
  }
  
  const mapStateToProps = (state) =&gt; ({
      initialValues : state.someName.rows,
      someName : state.someName,
  });
  
  const mapDispatchToProps = (dispatch) =&gt; ({
      dispatch,
  });
  
  ComponentName = reduxForm({
      form : 'formName',
      destroyOnUnmount: false
  })(ComponentName);
  
  export default connect(mapStateToProps, mapDispatchToProps)(ComponentName);
  </code></pre>