Getting the value selected with Formik

Viewed 71

I have this function that allows me to get the ID of the value that was selected in the form.

<Field
  component="select"
  name="account_rep_id"
  className="form-control"
>
  <option key={0} value={0}>
    All
  </option>
  {accountReps.map(function(list) {
    return (
      <option
        key={"accountReps_" + list.id}
        value={list.id}
      >
        {list.rep_full_name}
      </option>
    );
  })}
</Field>

accountReps is just the a list of names.

When I

mapPropsToValues({reducer)

account_rep_id: reducer.report.account_rep_id,

I get the id export and everything is fine, what id like to do is to also be able to get the text value that was selected and somehow also export it so I can use that when I later.

0 Answers
Related