SelectInput ignores emptyValue property
See original GitHub issueWhat you were expecting: The emptyValue is sent when the empty option is selected in a SelectInput.
What happened instead: An empty string is sent.
Steps to reproduce: Add emptyValue={null} property to a SelectInput.
Related code:
<ReferenceInput source="assignedToId" reference="users">
<SelectInput optionText="username" emptyValue={null} />
</ReferenceInput>
When the form loads, {assignedToId: null, …} is received, but when the user clicks save then the form sends {assignedToId: ‘’, …}
Environment
- React-admin version: 4.2.6
- Last version that did not exhibit the issue (if applicable):
- React version: 18.2.0
- Browser: Chrome
- Stack trace (in case of a JS error):
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Allow empty value "" as choice in selectInput - Stack Overflow
I am developing a shiny application which has a selectInput filter whose choices are coming from a dataframe of NAMES.
Read more >AutocompleteInput emptyValue prop is ignored #8091 - GitHub
This applies to the SelectInput as well. In your codesandbox, if you change the AutocompleteInput by a SelectInput , you get the same...
Read more >Input Components - React-admin - Marmelab
Such components allow to edit a record property, and are common in the <Edit> and ... <SelectInput source="category" allowEmpty emptyValue={null} choices={[ ...
Read more >Should a blank option always be included in <select> inputs?
This way we force the user to think about it and ensure they select the correct option. This helps improve the accuracy of...
Read more >Custom Filtering • reactable - GitHub Pages
Use reactR::html_dependency_react() to explicitly include this dependency or ... This example shows how you can render a custom <select> input filter in R....
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 Free
Top 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
I encount this problem too.
I tried some cases.
Besides,
<SelectInput>
shouldn’t acceptnull
as a possibleemptyValue
- see #8235.