When trying to add a tag to a View by choosing 'Edit view name/description' and then adding a tag. I get the following javascript error:

TypeError: undefined is not a function (evaluating 'suggestions.indexOf(tagged[i])')

original work done in #2574743: Cannot add a new taxonomy tag with "Tagged with" when creating a new View but turns out that was meant to be an issue about something else.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lendude created an issue. See original summary.

Lendude’s picture

Lendude’s picture

Status: Active » Needs review
ndf’s picture

Status: Needs review » Reviewed & tested by the community

When editing the tags of a new View this ajax-error occur:
Uncaught TypeError: suggestions.indexOf is not a function

After clicking apply this error occurs:
Uncaught TypeError: Cannot read property 'replace' of undefined

When editing the tags of an existing View the same error occurs after clicking apply.
Uncaught TypeError: Cannot read property 'replace' of undefined
It doesn't matter if there were actual changes in the tags. Just clicking apply is enough.

So I can confirm the error.

The patch does fix this specific issue.

But there are a bunch of related issues with views-tag. Both on input-time (like this issue) as on usage-time (with primary examle the views-overview-page).
I'll create related issues and link those in this issue too.
This one RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs manual testing

The autocomplete still does not work as expected for multiple tags. For example if a view is tagged with default, zoo and I go to another view and starting adding the zoo tag it does not provide an autocomplete suggestion of zoo if the view already has a tag.

Lendude’s picture

@alexpott Multiple tags have never worked like you'd expect, they don't work like that in D7 either. It has always been treated as one giant tag for autocompletion, no matter if you put a comma in it (and no matter what the description says). So making it break on a comma would actually be adding new functionality.

In D7 the tags filter on the views overview page would split on comma (so commas did do something). In D8 there is only a global search field on the views overview page that doesn't search in tags at all.

So the current patch brings the functionality back in line with D7. Is that enough for 8.0.x or do we want the extended (expected) functionality for 8.0.x?

damiankloip’s picture

In D7 you can add multiple. comma separated tags and it works fine IIRC, for filtering at least.

EDIT: also misread the last comments... Autocompletion of tags in D7 was indeed one giant tag, so a tag of 'admin, something else' would show up an autocomplete of 'admin, something else'.

alexpott’s picture

Status: Needs work » Reviewed & tested by the community

Yep so this fixes the bug - personally I feel the autocomplete behaviour actually makes things more confusing but that is for another issue.

damiankloip’s picture

RTBC +1

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

I manually tested the patch and autocomplete works in the same way it does for D7. I've run the test without the fix and fails as expected. Committed 5f5f396 and pushed to 8.0.x and 8.1.x. Thanks!

I think we could open a followup for 8.1.x (or another minor release) where we fix the behaviour of the autocomplete - it does not make a lot of sense atm to me.

  • alexpott committed 25207d3 on 8.1.x
    Issue #2618034 by Lendude: Adding tag to a View gives an error
    

  • alexpott committed 5f5f396 on
    Issue #2618034 by Lendude: Adding tag to a View gives an error
    
    (cherry...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.