tagmanager
tagmanager copied to clipboard
onlyTagList not working in conjuction with typeahead.js
when trying to use the "onlyTagList" option while also using typeahead.js it is still allowing creation of new tags. I believe this has to do with the following:
// check if restricted only to the tagList suggestions
if (opts.onlyTagList && undefined !== opts.tagList ){
the opts.tagList option when logged in the console is always null. so it is being caught immediately.
Same thing, it is not working at all
Did you guys find a workaround by chance?
Same problem here. The tagList var does not consider the values returned by typeahead.js. This needs to be fixed.
I think this is working properly on my site actually, but can check in a few days.
The UI doesn't allow anything but type ahead selected values to be input.
On Wednesday, Oct 1, 2014 at 9:18 AM, titos1 [email protected], wrote:
Same problem here. The tagList var does not consider the values returned by typeahead.js. This needs to be fixed.
— Reply to this email directly or view it on GitHub.
It can't work, because of the code quoted above. The allowed values must be specified in the tagList option, which is not populated anywhere in the code by typeahead.js
Ah, for me, my typeahead endpoint is restricting the values to the set I need itself, so perhaps I can't comment on this issue. I'm just turning off free input, not using a local js array to restrict input.
Hmm any fix for this? Wouldn't it be possible to add a validation function that checks the tag against the same tag source as typeahead? Or is there a way to manually specify the allowed values for the tagList option? EDIT: I set my taglist array as a global var and used it for the taglist option and got it working.
Hey @max-favilli and @johnnyshields are there any plans on fixing this issue? Is it even acknowledge as an issue? Thanks :)
@hessius could you provide us some sample code ? thanks
in the config of the tagsmanager initiation add tagList: yourTagListVariable,
So as long as typeahead adds something thats in the taglistvariable array tagsmanager will accept it
Does yourTagListVariable contain every possible value the typeahead might return?
How's this solving the problem?
Yes. I'm passing the same array to tags manager as I am to type ahead. Thus I'm basically doing manually what's broken in this issue i.e. I get exclusion of values not in the array, thus "fixing" the issue in one line of code.
If one had for example a type ahead array with datums one would need a separate array of just the displayed text to pass to tm
I don't think this is an acceptable solution though. The typeahead's job is to filter and get only a subset of all the possible items, based on the (partial) user input. The full set might contain millions of items. It is just not practical to pre-populate an array with all of these. A subset is supposed to be fetched based on user input.
Yes but as far as I understand that is not what this does in any situation. This checks the user entry regardless of usage of typeahead's suggestions. Thus it needs to check the whole list of possibilities. And since it just iterates over the array once even if it would contain millions of entries it wouldn't take more than a few ms Source: http://benhollis.net/blog/2009/12/13/investigating-javascript-array-iteration-performance/
This is what TagManager v2 used to do.
I see this issue raised quite a few times, and it is still an issue in the current version
For example, it is said to be fixed in #171
Raised in #118, #164, #191, and the aforementioned issue too.
Any update on this? V2 works as it should but this version and the latest Typeahead does not...
still no update on that issue? Not sure if there is a quick workaround?