Reputation: 4537
I have an input
field which takes values from the values set on the state by selecting items from a dropdown
.
<Field
name="test"
type={"text"}
component={props =>
<input readOnly value={instance.state.itemType} onChange={this.handleChange.bind(this)}
/>
}
/>
However, the input value changes, but the onChange
function is not getting triggered due to which the handleSubmit
function does not capture the value of this input
field.
Am I doing this right? Please suggest
Upvotes: 1
Views: 1427
Reputation: 4537
After searching around for a bit, I found that the props
variable isn't exactly props
.
It contains all the events relevant for a user.
So, I manually triggered an onChange()
event using props.input.onChange('myDesiredValue')
;
This is what I could come up with, sort of hacky but solves my current requirement.
Upvotes: 2