Allow choice value to be 0
See original GitHub issueI have a choice which value is 0, and it seems like nothing happens when I click this option. ( It does not trigger the change
event )
const choices = [{
value: 0,
label: 'Label 1'
}]
I tried to change the value to any number other than zero, and it works fine.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
choices[].value = 0 is converted to a table. · Issue #2404 - GitHub
choices [].value allows to set a table as value when it clearly can do only strings and integers. I found out this by...
Read more >Display or hide zero values - Microsoft Support
Display or hide all zero values on a worksheet Click File > Options > Advanced. Under Display options for this worksheet, select a...
Read more >How to Set Choice Field Default Value to Blank in SharePoint?
By default, when you create a new choice field, the very first choice you entered is also set as “Default value” in field...
Read more >why select option value if zero post empty - Stack Overflow
I am if select value="0" option and this post, it retuns the value with no problem. But, when I use value = 0...
Read more ><input type="range"> - HTML: HyperText Markup Language
elements of type range let the user specify a numeric value which must be no ... option { padding: 0; } input[type="range"] {...
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
Looks like this is caused by this line: https://github.com/jshjohnson/Choices/blob/master/assets/scripts/src/choices.js#L1142
Anything ‘falsey’ will not trigger the change event (ie; 0 or an empty string). I’m not sure what the original reason for this check was, but it seems like it should explicitly be looking for null or undefined instead.
Great to see this is fixed! Would it be possible to cherry pick this into master as a patch release? More than happy to submit a PR to master with just the changes from #349 if thats helpful 😃