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

if input typed tags > maxTags dropdown still showing #307

Closed
hitodev opened this issue Mar 7, 2015 · 3 comments
Closed

if input typed tags > maxTags dropdown still showing #307

hitodev opened this issue Mar 7, 2015 · 3 comments

Comments

@hitodev
Copy link

hitodev commented Mar 7, 2015

Hello

If typed tags exceeds maxTags value, the limitation works fine but input still presenting the dropdown with possible value, is there a way :

  • to prevent (hide) dropdown/value suggestions when user try to enter maxTags + 1
  • or to show a message when user try to enter maxTags + 1 (e.g. : "max allowed inputs for this field : maxTags") ?

(bootstrap 3 version)

@hitodev
Copy link
Author

hitodev commented Mar 7, 2015

temp. fixed by adding

.bootstrap-tagsinput-max .tt-input{display:none;}

@lucknerjb
Copy link
Contributor

This is definitely a valid point but I'm not sure how to attack it exactly. Showing an error message to the user is not an option as there are too many UI / UX considerations to take into account and it's outside of the scope of the plugin.

As for not showing the dropdown... I think that should be left to the developer.

Maybe something like:

  • user enters 5 tags. 5 is the max they are allowed
  • on the 5th tag, the "maxItemsReached" event is fired
  • the developer runs code such as this:
$('.bootstrap-tagsinput-max .tt-input').css('display', 'none');
  • if the user removes a tag, the "itemRemoved" event is fired (as is the case now) and the dev can now remove his custom CSS

I think adding this extra event is the way to go to keep the plugin's footprint / scope as small as possible

@lucknerjb lucknerjb added this to the Release 0.9.0 milestone Nov 11, 2015
@lucknerjb
Copy link
Contributor

I've thought about this some more and I don't think adding another event is the way to go. Does this event only get fired when the max was reached? Should it be fired if the user continues to try and add a tag? I think that there are too many different use cases.

Easiest solution:

  • Initiate a counter on your end
  • Increment the counter by hooking into the itemAdded event
  • Handle the max items reached event yourself

Closing ticket as this feature will not be added.

@lucknerjb lucknerjb added invalid and removed bug labels Nov 17, 2015
@lucknerjb lucknerjb removed this from the Release 0.9.0 milestone Nov 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants