-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use react-select inside redux-form lost selected value issue #1185
Comments
You need to override the default <Select {...field} onBlur={() => field.onBlur(field.value)}`/> |
Hi erikras, Thank you very much for your quick response. I did, but still it doesn't work for me. I tried your example on #82 . Basically, what I did is, I build my own component with react-select, then main form(redux-form) I used my component. my select component render() {
main form <InvoiceMonth {...period} /> Thanks for your help. |
@erikras I am taking
<Select.Async loadOptions={this.props.getOptions} {...this.props} />
<form>
<Field name="selectField" component={SelectionComponent} loadOptions={getOptions}/>
</form> As you are suggesting to override <Select {...field} onBlur={() => field.onBlur(field.value)}`/> Can you be more specific how I can do this in |
@akashshinde <Select.Async
loadOptions={this.props.getOptions}
{...this.props}
onBlur={() => this.props.onBlur(this.props.value)}/> Then use |
@erikras Just tried it with |
Hey guys I tested the code above on
|
I'm still having the same issue .. basically the onBlur event makes the value of the input box to null. Am i missing something? here's my code
|
For those using redux-form v6, one important note about the answer above from @Marswang92 — |
@Marswang92 @jmwohl I am using redux form v6, react-select 1.0. I am still getting "Cannot read property 'onBlur' of undefined" even when onBlur is called after spread operator. here is my code:
Any help would be greatly appreciated..! thanks |
Nevermind, I got it worked when I use "props.input.onBlur" instead of "this.props.input.onBlur". But still when I select the value it is set to value="" |
finally I got it working, <Field name="redux-form-field-name" type="text" component={props => |
Thanks to everyone for putting in the legwork on this issue! You all saved me so much time! 🎊 🎉 🎂 |
Yes. A big thank you. I simply never would have been able to work that out myself! Fantastic! |
Hi! I render my select as: import { Field as RField } from 'redux-form';
import {
Input,
Checkbox,
Radio,
Select,
TextArea,
Button,
Form
} from 'semantic-ui-react'
/*...*/
return <Form.Field required={required}>
<label>{label}</label>
<Select
name={full_name}
label={label}
placeholder={label}
options={options}
onChange={input.onChange}
onBlur={input.onBlur}
multiple={multiple}
disabled={disabled}
required={required}
{...props}
{...attr}
/>
</Form.Field> and insert this in component prop. And i have problem with first loose focus on change... I create gist with full code https://gist.github.com/Slavenin/b046996373103b0a7a0261c0dbdabb09 |
I solve this problem. onChange={(e, data) => {input.onChange(data.value)}} |
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. |
Hi All,
I used react-select inside redux-form, and I have an issue for selected value. When I select value then change focus to other input, the react-select selected value become empty. I searched all internet and couldn't find and solution, could someone help me please?
Thanks,
The text was updated successfully, but these errors were encountered: