question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown: Empty string should be valid value

See original GitHub issue

Steps

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

Example, and html behaviour to compare (which I expected)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
odiseo42commented, Jun 21, 2017

I’m also having issues with this. Is there any reason for what empty string cannot be a value?

3reactions
tad-lispycommented, Oct 30, 2019

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 with onChange callback and I clear it, the value passed to onChange is "". I think it’s not very semantic (pun intended). I would say that semantic way of representing “no value” in JS is null 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found