I have two fields on my redux form, field_A and field_B. Both of these are select fields. After selecting field_A, initialValues of the redux form populates the value for field_A, and loads the options for field_B, for the user to select. Once the user selects field_B, my initialValues of the redux form populates the values of Field_B.
If I now change field_A, new options for field_B are loaded for the user to select. On the UI, the value for field_B clears, but the initialValue still has the value of field_B. The user would be able to submit this form, instead of getting the "Required" validation error. They send a mismatching combination of field_A and field_B to the backend.
When I execute the onChange when selecting field_A, I want to clear the value of field_B back to undefined, so that the user cant submit the form, until they re-select a value for field_B. How can I do this? I tried to use the following link's documentation, but maybe I am misusing the change function. Maybe the change function isn't even the solution.
I tried this.props.change("field_B", undefined) but this didnt change the initialValues.field_B value.
I also tried this.props.initialValues.change("field_B", undefined) but this call errored out.