Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select2 on clear does not change input element value NOR fire change event #3452

Closed
kartik-v opened this issue Jun 9, 2015 · 5 comments
Closed

Comments

@kartik-v
Copy link
Contributor

kartik-v commented Jun 9, 2015

On clearing a value (when allowClear) is true... the base select element value is not changed (shows the old value) - NOR is the change event triggered.

@kevin-brown
Copy link
Member

Must have missed this ticket, but I can't seem to reproduce the issue.


Can you expand upon the issue you are facing by adding a few more pieces of information to your bug report?

  • What steps can be used to reproduce the issue?
  • What is the bug and what is the expected outcome?
  • What browser(s) and Operating System have you tested with?
  • Does the bug happen consistently across all tested browsers?
  • What version of jQuery are you using? And what version of Select2?
  • Are you using Select2 with other plugins?

The contributing guide contains a useful section with a few questions which can help us track down the bug and speed up the process of finding a fix for it. The creation of an isolated test case would also be useful.

@kartik-v
Copy link
Contributor Author

Actually my mistake in describing - the change event does fire... but it does after the select2:unselect.

This was more related to issue #3320 when the select2 does not close on clearing.

Was trying to trap the value of the input after select2:unselect and not after a normal change. It shows the old value on unselect unlike the change. But I need it similar to what happens after select2:select which is triggered after the change - so we can see the new value of the input. Currently I do not have a method to do this... and need to rely on change which is not what I need.

The select2:unselect probably needs to be triggered after the change event similar to how it happens for select2:select.

@ghost
Copy link

ghost commented Jul 3, 2015

@kartik-v Had the same problem (in a complex ajax & pagination scenario) but I've just missed to add the placeholder option like

@kartik-v
Copy link
Contributor Author

kartik-v commented Jul 3, 2015

@andreasbernhard I feel the solution is that on pressing the clear icon, the input val must be cleared and the change event must be triggered before select2:unselect.

@kevin-brown kevin-brown added the 4.x label Jul 4, 2015
@alexweissman
Copy link
Contributor

Please continue discussion in #3320.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants