Inputting the exact value not choosing the option when the value and display text are different
See original GitHub issuePrerequisites
- I have searched for similar issues in both open and closed tickets and cannot find a duplicate
- The issue still exists against the latest
master
branch of Select2 - This is not a usage question (Those should be directed to the community)
- I have attempted to find the simplest possible steps to reproduce the issue
- I have included a failing test as a pull request (Optional)
Steps to reproduce the issue
-
Create an select element with value not equal to the display text.
-
Call the select2 function, with tag function turned on Or 1+2. https://jsfiddle.net/rLmztr2d/237/
-
Input a value that is equal to the display text and press
,
Expected behavior and actual behavior
When I follow those steps, I see… A new tab created with value and display tag both equal to the input value
I was expecting… The option with the display text chosen, no new tab created.
Environment
Browsers
- Google Chrome
- Mozilla Firefox
- Internet Explorer
Operating System
- Windows
- Mac OS X
- Linux
- Mobile
Libraries
- jQuery version: 2.2.1
- Select2 version: 4.0.3
Isolating the problem
- This bug happens on the examples page
- The bug happens consistently across all tested browsers
- This bug happens when using Select2 without other plugins
- I can reproduce this bug in a jsbin
P.S. I have already found a way to hot fix the problem, but I hope select2 will fix it so that no more hot fix is needed. https://stackoverflow.com/questions/46361910/select2-error-on-tag-when-value-is-not-the-same-as-display-value/46362316#46395657
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Set text input field display value different from actual value
The user interface could allow display/entry of a category, but the data structure could retain the value as a categoryId. You could then...
Read more ><input type="text"> - HTML: HyperText Markup Language | MDN
Any values in the list that are not compatible with the type are not ... can select from this predefined list or provide...
Read more >Apply data validation to cells - Microsoft Support
Select Data >Data Validation. ... On the Settings tab, under Allow, select an option: ... Select OK. Now, if the user tries to...
Read more >More on data validation - Microsoft Support
You can use data validation to restrict the type of data or values that users ... You can choose to show an Input...
Read more >Video: Create and manage drop-down lists - Microsoft Support
Data entry is quicker and more accurate when you use a drop-down list to limit ... list's down-arrow appears, and they can click...
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
My mistake, I believe I misunderstood your issue. It sounds to me like this is actually a duplicate of #4610, then?
This is a duplicate of #4779 and #3681. Please search the issues carefully before opening a new one!