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.

Inputting the exact value not choosing the option when the value and display text are different

See original GitHub issue

Prerequisites

  • 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

  1. Create an select element with value not equal to the display text.

  2. Call the select2 function, with tag function turned on Or 1+2. https://jsfiddle.net/rLmztr2d/237/

  3. 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
alexweissmancommented, Sep 25, 2017

My mistake, I believe I misunderstood your issue. It sounds to me like this is actually a duplicate of #4610, then?

1reaction
alexweissmancommented, Sep 25, 2017

This is a duplicate of #4779 and #3681. Please search the issues carefully before opening a new one!

Read more comments on GitHub >

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

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