Hi, I discovered the follow bug:
I have a node based view, with a relation to taxonomy terms from a specific vocabulary.
After adding a (exposed) filter (select or autocomplete) and mandatory based on the term I chose the correct vocabulary for the filter. After saving the filter and returning to it's settings, my selected vocabulary was not saved and the first vocabulary in my list was selected.
It doesn't save the selected option, which causes to break the view, because I have set it to be mandatory and the term does not match it's vocabulary. It causes the following error: No valid values found on filter: Taxonomy term: Term.
This option is probably widely used to create filtered archives for content based on taxonomy terms (that's what i'm using it for) so I marked this major.
I have no idea how to fix this, so unfortunately I can't provide a patch.
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#5 | views-taxonomy-filter.jpg | 251.49 KB | ericclaeren |
Comments
Comment #1
ericclaeren CreditAttribution: ericclaeren commentedPutting this priority to normal. Found out 2 things.
The error is caused because there's no term/option selected in the select list, while the option "Limit list to selected items" is not selected. You would expect when you don't select a term from the list and put the filter to mandatory, that it uses the first term. Seems that's not the case here.
Found the reason for the broken vocabulary choice.
In: views\modules\taxonomy\views_handler_filter_term_node_tid.inc on line 47 there's the following statement:
Although I have set a value, and it's stored, the following returns true, so the value gets overwritten with the first vocabulary. When I change it to
It works like it suposed to. Does anyone know how this is possible?
Thanks.
Comment #2
dawehnerWhat's the content of $this->options['vocabulary'] here for you? This special code should only be runned when a user doesn't have selected a vocabulary yet. Maybe this would help to understand the issue.
Comment #3
ericclaeren CreditAttribution: ericclaeren commentedThanks for your reply, $this->options['vocabulary'] has contains the machine name of the selected vocabulary, when printed before this function, after the function it resets to the first vocabulary. The first funtion overwrites the existing one.
Comment #4
dawehnerSure but how can $this->options['vocabulary'] == 0 if it's 'a random value'?
Comment #5
ericclaeren CreditAttribution: ericclaeren commentedWho spoke about a random value?
This code:
Produces this error:
The first var_dump returns the selected vocabulary, in my case uzine, while the second after $this->options['vocabulary'] == 0 statement returns a different value (the first vocabulary: tags). So after saving and returning to the term filter settings, the selected option is tags, instead of the stored value of uzine.
Quite weird.
My other problem is, after exposing the filter and set it to mandatory (sorry about the partly dutch translation).
Is that the input is not valid which produces the error:
But the option, "Limit list to selected items" is not selected, so It should use all terms within the vocabulary (that's what I'm expecting) but that's not the case. Because of the error the view can't be saved.
Thanks, I appreciatie your help.
Comment #6
dawehnerI totally don't get why it's doing this but a check for === 0 makes sense, as the default value is 0
Comment #7
ericclaeren CreditAttribution: ericclaeren commentedAnybody got an idea why I get this error No valid values found on filter: Taxonomy term: Term. on the exposed filter? It's driving me crazy :)
The view has filter:
Taxonomy Term > Dropdown
- Exposed = TRUE
- Required = TRUE
- Is one of
- LIMIT = FALSE
It should just use the first taxonomy term in the filter, and the preview displays the correct term, but then this error appears.
Comment #8
dawehnerwhat happens if you remove it and reconfigure it using a new vocabulary?
It would be kind of cool to have an easy way to reproduce.
Comment #9
ericclaeren CreditAttribution: ericclaeren commentedHi dereine, unfortunately there is no difference when using a new vocabulary. Neither for both problems.
Problem of the error lies in the fact, that views thinks it has no input, when no item is selected in the list of limited terms of the exposed filter setting when the exposed filter is required.
While the input should be all available items (terms) when it's a required field, and when it's required and limit to.. is true, it should only use limited items instead of all.
Comment #10
esmerel CreditAttribution: esmerel commentedComment #11
cgdrupalkwk CreditAttribution: cgdrupalkwk commentedI have the same problem. Has anyone found a solution?
Comment #12
Taxoman CreditAttribution: Taxoman commentedComment #13
RobNL CreditAttribution: RobNL commented@cgdrupalkwk I had the same problem in Views 7.x.3.7. The solution #1 did the trick for me.
Comment #14
tchurch CreditAttribution: tchurch commentedThe solution in #1 seems to be redundant now after 7.x.3.7 as those lines were changed.
Does anyone have a solution to this yet?
Comment #15
tchurch CreditAttribution: tchurch commentedI did find a workaround.
To select a value in the list of terms allowed but leave "Limit list to selected items" unticked.
It seems to work then but one shouldn't need to select a term from the list.
Comment #16
chrisgross CreditAttribution: chrisgross commented6 years later, this bug still exists in the newest version of views.
Comment #17
fwood CreditAttribution: fwood commented7 years later it still exists. .. at least for me.