Dropdown: Empty string should be valid value
See original GitHub issueSteps
There is component
<Dropdown selection options={[{value: '', text: "someText"}] />
Expected Result
<Dropdown selection options={[{value: '', text: "someText"}] value="" />
wil show text "someText"
Actual Result
Empty field displayed
Version
0.68.5
Testcase
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:15 (3 by maintainers)
Top Results From Across the Web
How to assign empty value to select dropdown? - Stack Overflow
I need to assign "" to the dropdown selectedvalue due to some third party legacy code issues.
Read more >Dropdown menu - Null or empty string?? - MSDN - Microsoft
I would like to store empty string instead of Null using dropdown list. Is it possible? Yes, It is possible. Ideally, when you...
Read more >DropDownValidate and allow empty string | Infragistics Forums
Now here is my problem: I want the user to be able to set the cell value to blank/EmptyString, but since this value...
Read more >Why does AngularJS include an empty option in select
The easiest way to correct this error is to reference a valid value from the ng-option list. The value referenced must be available...
Read more ><select>: The HTML Select element - HTML - MDN Web Docs
If no value attribute is included, the value defaults to the text contained inside the element. You can include a selected attribute on...
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
I’m also having issues with this. Is there any reason for what empty string cannot be a value?
Hi! Thanks for all your hard work on Semantic UI and it’s React bindings. I’m using it for the first time and it seems like a very nice framework. Let me get to the point.
Am I right in thinking that underlying issue is that no selection state is represented as the empty string? For example when I have a
clearable
dropdown withonChange
callback and I clear it, the value passed toonChange
is""
. I think it’s not very semantic (pun intended). I would say that semantic way of representing “no value” in JS isnull
or in case of multi-select an empty array.If you agree with my thinking above and we could change the representation of “no selection”, this should clear the path to allow empty strings as valid values. This would be a breaking change, so before I attempt to prepare a PR I’d like to get some feedback on the idea.