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

Need max tag option #40

Open
dexterousworld opened this issue Sep 10, 2013 · 3 comments
Open

Need max tag option #40

dexterousworld opened this issue Sep 10, 2013 · 3 comments

Comments

@dexterousworld
Copy link

There is no max tag option available in it, I want to add max 3 tags not more than that. If any one knows, how to do this, pls share it with me.

Awaiting response on above request.

@satishkadyan
Copy link

Same thing i am looking, should able to restrict minimum or maximum entries for a tag box. like minimum 3 tags or maximum 5 or both combination.

if some one have changed code for the same , then please let me know.

thanks

@satishkadyan
Copy link

Hi, i have make some changes to code to add maxtag option

Here are detail of changes

  1. add maxtags:null, to options array line 79 i added
  2. add if( options.maxtags==null || elements.find('input.tag-input-hidden-count').length < options.maxtags){
    after if(options.allowAdd == true || oldValue) { on line 180 and close } brace for condition before uper if close.
  3. replace html += ''; to html += ''; on line 186,
    (class added to count no of tags)
  4. replace html += ''; to html += ''; on 132 line (class added to count no of tags)
  5. use , in calling the code in your html call option like $( "#tagform-full" ).find('input.tag').tagedit({
    autocompleteURL: 'server/autocomplete.php',
    maxtags:5,
    });

thanks,
satish k

@akempes
Copy link

akempes commented Feb 25, 2014

It seems some information is missing at step 3 and 4...

Add the class "tag-input-hidden-count" to the hidden input field and it will work!

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

3 participants