Limit list to selected items doesn't work. I have a two-tier vocabulary and I want to limit the exposed filter select options to those items of a particular first-tier term. I have selected all of the terms that I want to show up in the select list, checked "Optional", "Force single" and "Limit list to selected items", but the full list still appears.
$view = new view;
$view->name = 'resource_library';
$view->description = 'Resource Library';
$view->tag = 'Resource Library';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'created' => array(
'label' => 'Date posted',
'date_format' => 'medium',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
),
'changed' => array(
'label' => 'Date updated',
'date_format' => 'medium',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'changed',
'table' => 'node',
'field' => 'changed',
'relationship' => 'none',
),
'field_public_description_value' => array(
'label' => '',
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_public_description_value',
'table' => 'node_data_field_public_description',
'field' => 'field_public_description_value',
'relationship' => 'none',
),
'teaser' => array(
'label' => '',
'exclude' => 0,
'id' => 'teaser',
'table' => 'node_revisions',
'field' => 'teaser',
'relationship' => 'none',
),
'view_node' => array(
'label' => '',
'text' => 'View resource >',
'exclude' => 0,
'id' => 'view_node',
'table' => 'node',
'field' => 'view_node',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'title' => array(
'id' => 'title',
'table' => 'node',
'field' => 'title',
),
));
$handler->override_option('arguments', array(
'tid' => array(
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'resource3' => 'resource3',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'tid_2' => array(
'operator' => 'or',
'value' => array(
'50' => 50,
'51' => 51,
'52' => 52,
'53' => 53,
'54' => 54,
'55' => 55,
'56' => 56,
'57' => 57,
'58' => 58,
'59' => 59,
'60' => 60,
'61' => 61,
'62' => 62,
'63' => 63,
'64' => 64,
'65' => 65,
'66' => 66,
'67' => 67,
'68' => 68,
'69' => 69,
'70' => 70,
'71' => 71,
'284' => 284,
'72' => 72,
'285' => 285,
'73' => 73,
'286' => 286,
'74' => 74,
'76' => 76,
'77' => 77,
'78' => 78,
'79' => 79,
'81' => 81,
'83' => 83,
'84' => 84,
'82' => 82,
'85' => 85,
'86' => 86,
'87' => 87,
'89' => 89,
'88' => 88,
'90' => 90,
'91' => 91,
'92' => 92,
'93' => 93,
'94' => 94,
'95' => 95,
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'tid_2_op',
'identifier' => 'category',
'label' => 'Category:',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 1,
),
'type' => 'select',
'vid' => '12',
'id' => 'tid_2',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 1,
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'tid' => array(
'operator' => 'or',
'value' => array(
'147' => 147,
'283' => 283,
'148' => 148,
'149' => 149,
'150' => 150,
'151' => 151,
'152' => 152,
'153' => 153,
'154' => 154,
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'tid_op',
'identifier' => 'population',
'label' => 'Applicable Population:',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 1,
),
'type' => 'select',
'vid' => '14',
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'tid_1' => array(
'operator' => 'or',
'value' => array(
'96' => 96,
'258' => 258,
'259' => 259,
'260' => 260,
'261' => 261,
'262' => 262,
'263' => 263,
'265' => 265,
'264' => 264,
'266' => 266,
'267' => 267,
'268' => 268,
'269' => 269,
'270' => 270,
'271' => 271,
'272' => 272,
'273' => 273,
'274' => 274,
'275' => 275,
'276' => 276,
'277' => 277,
'278' => 278,
'279' => 279,
'280' => 280,
'281' => 281,
'282' => 282,
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'tid_1_op',
'identifier' => 'docutype',
'label' => 'Document Type:',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 1,
),
'type' => 'select',
'vid' => '1',
'id' => 'tid_1',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
'relationship' => 'none',
'reduce_duplicates' => 0,
'override' => array(
'button' => 'Override',
),
),
'tid_3' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'type' => 'textfield',
'vid' => '12',
'id' => 'tid_3',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('title', 'Resources');
$handler->override_option('empty', 'No resources in this category at this time.');
$handler->override_option('empty_format', '3');
$handler->override_option('items_per_page', 30);
$handler->override_option('use_pager', '1');
$handler->override_option('row_options', array(
'inline' => array(
'title' => 'title',
'timestamp' => 'timestamp',
),
'separator' => '',
));
$handler = $view->new_display('page', 'Library', 'page_1');
$handler->override_option('path', 'resources/library');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Training & Education', 'page_2');
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'resource3' => 'resource3',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'tid_3' => array(
'operator' => 'or',
'value' => array(
'0' => '76',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'type' => 'textfield',
'vid' => '12',
'id' => 'tid_3',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'tid_2' => array(
'operator' => 'or',
'value' => array(
'76' => 76,
'77' => 77,
'78' => 78,
'79' => 79,
'81' => 81,
'83' => 83,
'84' => 84,
'82' => 82,
'85' => 85,
'86' => 86,
'87' => 87,
'89' => 89,
'88' => 88,
'90' => 90,
'91' => 91,
'92' => 92,
'93' => 93,
'94' => 94,
'95' => 95,
'50' => 0,
'51' => 0,
'52' => 0,
'53' => 0,
'54' => 0,
'55' => 0,
'56' => 0,
'57' => 0,
'58' => 0,
'59' => 0,
'60' => 0,
'61' => 0,
'62' => 0,
'63' => 0,
'64' => 0,
'65' => 0,
'66' => 0,
'67' => 0,
'68' => 0,
'69' => 0,
'70' => 0,
'71' => 0,
'284' => 0,
'72' => 0,
'285' => 0,
'73' => 0,
'286' => 0,
'74' => 0,
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'tid_2_op',
'identifier' => 'category',
'label' => 'Category:',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 1,
),
'type' => 'select',
'vid' => '12',
'id' => 'tid_2',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 1,
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'tid' => array(
'operator' => 'or',
'value' => array(
'147' => 147,
'283' => 283,
'148' => 148,
'149' => 149,
'150' => 150,
'151' => 151,
'152' => 152,
'153' => 153,
'154' => 154,
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'tid_op',
'identifier' => 'population',
'label' => 'Applicable Population:',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 1,
),
'type' => 'select',
'vid' => '14',
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'tid_1' => array(
'operator' => 'or',
'value' => array(
'96' => 96,
'258' => 258,
'259' => 259,
'260' => 260,
'261' => 261,
'262' => 262,
'263' => 263,
'265' => 265,
'264' => 264,
'266' => 266,
'267' => 267,
'268' => 268,
'269' => 269,
'270' => 270,
'271' => 271,
'272' => 272,
'273' => 273,
'274' => 274,
'275' => 275,
'276' => 276,
'277' => 277,
'278' => 278,
'279' => 279,
'280' => 280,
'281' => 281,
'282' => 282,
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'tid_1_op',
'identifier' => 'docutype',
'label' => 'Document Type:',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 1,
),
'type' => 'select',
'vid' => '1',
'id' => 'tid_1',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
'relationship' => 'none',
'reduce_duplicates' => 0,
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('title', 'Training & Education');
$handler->override_option('path', 'resources/training-and-education');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
Comments
Comment #1
merlinofchaos commentedThat view is pretty complex, with two different page displays and multiple exposed filters. Only one of the displays appears to actually have a reduced set of filters to display, and you didn't specify which filter exactly you're having an issue with.
Also, Views 2.2 is out, you really should update before filing bugs against Views 2.1. How do you know your bug wasn't fixed in the next version?
Comment #2
capellicThanks for your speedy response, and sorry not being up on 2.2, but I read the release notes and didn't see anything in there that spoke to my issue. But then I'm sure that there are many more tweaks and fixes that aren't in a release note.
I upgraded to 2.2 and the issue is still there.
The issue is with the Training & Education display.
I have added some other exposed filters to this view since last night and observed a couple of things that might be of interest.
1. I have several taxonomy fields and they all have this problem.
2. I have a CCK Text field (with a Select list widget) and I DON'T have this issue. If it isn't checked, it doesn't appear as a value in the exposed filter.
You can see that in the two screenshots I have uploaded where I have "Planning" as un-checked, but it still shows up as a value in the exposed filter for Category.
Thank you for your time.
Comment #3
merlinofchaos commentedYou have two different exposed filters named 'Category:' in the View. One that is used in the default display (and thus every display except the other one) and one that is only in the display for 'Training & Education'.
Your image doesn't tell me which display you were looking at at the time.
Comment #4
merlinofchaos commentedYou have two different exposed filters named 'Category:' in the View. One that is used in the default display (and thus every display except the other one) and one that is only in the display for 'Training & Education'.
Your image doesn't tell me which display you were looking at at the time.
There are also a bunch of fields around that filter that are clearly not part of the exposed filter set. I don't understand what's happening there.
Comment #5
capellicSorry for the confusion, let's take it from the top.
I have been able to reproduce the same error on another, much simpler view. There is only one exposed filter and it is of a taxonomy field. There are two displays - default and Page. I am working with the Page display.
I have uploaded two screenshots that can hopefully shed some light on what I am seeing.
Comment #6
zet commentedI confirm this error
Comment #7
merlinofchaos commentedThis is crazy but I can't get my system to behave this way. I import the view, get rid of the fields I don't have, reset the vocabulary to one I do have and try this...and it works exactly correctly.
Comment #8
Toddv commentedUsing current releases of all pertinent modules I can confirm the problem (exposed filters don't limit the list as expected) but also that I was able to "fix" the problem.
I had a rather complicated view that was one display on a view with four other page displays. So I cloned the view, removed all but the display I want to limit the exposed filter list on, and saved the view.
Now the list is limited to just the filters I want. Worked for me...
I did have to go back and forth a few times between the original display and the clone as the clone had pages with paths that led back to the original when I attempted to edit the display.
Merlinofchaos - Thanks for all your work.
TV
Comment #9
perandre commentedI confirm this bug using exposed filter with Taxonomy: Term.
I tried to simplify by cloning and removing all other displays, but in the dropdown I still get all terms in the selected vocabulary even though "Limit list to selected items" is checked.
Comment #10
perandre commentedBug still applies with Views 2.5.
Here's an export:
Comment #11
esmerel commentedComment #12
perandre commentedAny news on this? Issue prevails in 2.6.
Comment #13
clarkburbidge commentedI can also confirm this issue in 2.6
Comment #14
harrisben commentedI'm also seeing this with 2.6
Comment #15
merlinofchaos commented#13 is teasing us. There aren't even exposed filters in that view.
And I just can't make this happen on anything I try. :/
Comment #16
perandre commentedI haven't managed to recreate the issue from scratch, but I have re-imported the attached view to find the same issue. No clue why...
Comment #17
perandre commentededit: double post.
Comment #18
held69 commentedi can confirm this issue in 2.7
On my site it only occurs with exposed filter.
Just to be clear:
My 'node type filter' is set with: "limit list to selected items", only two node types are checked.
However after applying my 'exposed filter' which is set on 'Any': all the node types on my site (more then two) are listed.
Comment #19
perandre commentedTried to recreate the bug in my sandbox using the attached view in #18, but it was ok. I've only had the issue with exposed taxonomy terms. Could it somehow be an issue with some non-views configs?
Comment #20
held69 commentedi'm suprised!
I think there is a slight difference in the issue mentioned in the startup and my own.
Did you applied the exposed filter with 'any' selected?
Did you really only get the 'selected items(nodetypes) as a search result.
To state clear:
I selected two node types (lets say blogs and stories)in my nodetype filter and marked 'limit list to selected items'.
When i apply my exposed filter with 'any' selected:
I not only get blogs and stories as a search result but also pages, polls and all the other nodetypes available on my site.
I expect my search result to be limited to the list of selected node types which does not happen.
I am able to recreate this issue on two of my sites, that is with views 2.6 and 2.7.
I'm thinking of some none view configs.........do you have some in mind?
Comment #21
perandre commentedTried an import with the view in #18 on another test site with tons of modules enabled; still no bug (latest d6 and views 2.7). No clue why...
Comment #22
perandre commentedAh, didn't see your full post before I commented.
I see, what you mention here is another issue. In the select box, only the appropriate filter alternatives shows up (i.e. the selected node types), but the result list using < Any > lists all kinds of content types. Do I understand you correctly? See img.
Comment #23
perandre commented-If that's the case, I think it's by design. You can filter by nodetype in addtion to the exposed filter, and you're good (if I understand you correctly).
The original issue is with the select box, which sometimes lists more alternatives than it should. With me, that has only happened with taxonomy:term.
Comment #24
held69 commentedYes this is exactly what i mean.
I would expect that 'any' in the exposed filter would give a search outcome that is limited to the "limited selected item list".
However i guess that 'any' does mean any contenttype on the site, regardless of the "limited selected item list".
It could very well be that it was made to act like this.
Thanks
Comment #25
harrisben commentedI can't imagine that it would be intended to work the way it is (ie 'any' ignoring selected filter). If it is, either a note should be added that 'Limit list to selected items' and 'Optional' are incompatible or one of them should be disabled depending upon what you've selected.
Comment #26
held69 commentedI agree
Comment #27
maestrogeek commentedCan confirm I have seen this in 6.x-30-alpha2.
I am seeing the Limit list to selected items setting being completely ignored when set. It appears to me that when set it in the UI it is not updating the view itself. I check this box, click Update, then return to the settings for the filter, and the setting is unchecked again.
I am seeing this in filters for both node types and taxonomy term with depth. Has any progress been made on this? Anyone come up with a workaround/fix?
Comment #28
Bilmar commentedThere is a patch RTBC at #721358: unable to select "Limit list to selected items" that fixes this issue.
Regards
Comment #29
dawehnerSo