Not selecting value if onChange is used
See original GitHub issueSo, my react-select component is not selecting the value. Here is my initialization code.
<Select
name="form-field-name"
options={ areas }
onChange={ this.areaSelected }
/>
This is the areaSelected.
areaSelected: function(value) {
AreaActions.setArea(value);
},
The action update my state beautifully, but the select component do not updated. Is it a bug?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7
Top Results From Across the Web
Why am I not getting the value from onChange with Select?
i tried that first. Issue is my form is being created dynamically. Jquery would handle it only if my select box was static...
Read more >SCR19: Using an onchange event on a select element ... - W3C
Navigate to the trigger select element, navigate through the options but do not change the value. Check that the matching option values are...
Read more >HTMLElement: change event - Web APIs | MDN
When the user commits the change explicitly (e.g., by selecting a value from a <select> 's dropdown with a mouse click, by selecting...
Read more >How to Use Option Selected Property in JavaScript - Tabnine
This approach has a problem – namely, if the user does not choose a different value, no change takes place. This means that...
Read more >Javascript onchange Event Tutorial to Get Dropdown Value of ...
... code of application here:https://codingshiksha.com/javascript/javascript- onchange -event-tutorial-to-get-dropdown- value - of - select -inp...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to set the
value={currentValue}
property.Hi All 😃
Sorry to ask a question on a closed issue but I have got react-select working ok eventually with redux-form until I added an onChange…now despite following the advice given above (updating State and setting the value attribute) react-select still will not allow me to Select a value from the list when the onChange has been added.
Could it be that the suggested workaround is not compatible with redux-form? If I console.log the value of the “value” attribute it seems to get lost when I call the ReduxForm.Field component, stopping the above suggested workarounds from, well, working.
Has anyone else seen this?
Thanks again!
Update
For anyone who gets led here by Google I think I sorted it. To get redux-form and react-select to play together basically ensure that Select.onBlur, onChange and value end up calling/using input.onBlur, input.onChange and input.value
Still testing but this seems to work with