I want to override the onChange event.
function handleCustomChange(event){
//Do something
//...
// I get event.target.value in here. But I got a old value. It's same different from the pure js's event object.
this.props.field.userName.onChange(newValue);
}
For example. The initial value of the userName field is Tom. the I input 'a'. The I got the 'Tom' from event.target.value and I expect it is 'Toma'.
So, How can I get the new value before I call redux-form's onChange handler?
Regards.
Are you using V5 or V6?
In V6 (RC3) I use the following:
<Field name="myField" component={props =>
<select
{...props}
onChange={event => {
console.log("This is the new value of field myField: " + event.target.value);
props.input.onChange(event); // <-- Propagate the event
}>
{myDynamicallyGeneratedOptions}
</select>
}/>
And it works fine.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Are you using V5 or V6?
In V6 (RC3) I use the following:
And it works fine.