Skip to content

Add requireAutocomplete option #37

Closed
wants to merge 4 commits into from
@cleishm
cleishm commented Sep 29, 2011

Require all tags to be created from autocomplete suggestions

@rstudner

I sort of pulled this off (the short hack version) with this (in createTag)
if (this.options.limitNewTags && $.inArray(value, this.options.availableTags) == -1) {
this._tagInput.val('');
//we just disallow this
return false;
}

with a limitNewTags boolean option on startup

@KieranP
KieranP commented Nov 13, 2011

+1 Need something like that so that only admins can create new tags, but anyone else must use the already defined ones.

@1ed
1ed commented Nov 20, 2011

👍

@litchfield

+1

@davidbgk

+1

@hrasguido

+1

@bond-
bond- commented Nov 23, 2012

+1

@aehlke
Owner
aehlke commented Nov 23, 2012

I'm going to first accomplish this in a generic way by adding a beforeTagAdded event hook which will let you decide whether or not to allow the tag to be added.

@aehlke
Owner
aehlke commented Nov 25, 2012

This exists now, check the updated docs for beforeTagAdded.

I'd still like to make this easier though, but you can accomplish it manually now at least without having to fork the project. Closing this for now, and I'll come up with a more elegant solution later (which is a bit tricky to do right).

@aehlke aehlke closed this Nov 25, 2012
@aehlke
Owner
aehlke commented Nov 25, 2012

To clarify, just return false in your callback to reject the tag.

@mandersondesign

Any update on this? And also, is there a good example of someone doing this in the correct way?

@sdrdis
sdrdis commented Sep 11, 2013

Is there any way to know when beforeTagAdded is called if the tag comes from the user input or the source ? Thanks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.