I enabled Views module on Drupal 7. Created a view, added filter and want to expose the filter. However, the checkbox for the expose filter is not sticking and filter is not getting exposed. I search on this issue, multiple articles and forum topics found. I enabled Ajax, do not have devel theme, or any other module that can possible conflict with this. Can't seem to find what else could be wrong. I even got the Better Exposed filter module and it did not help with this issue. I tried the dev version of views too, no luck. Any help is appreciated. I am so frustrated, I am thinking of uninstalling Drupal 7 and reinstalling Drupal 6.

Comments

drupalshrek’s picture

I understand how frustrating that must be. Exposed filters generally work fine in D7, so it's not clear where your problem lies. If the view is fairly simple (e.g. using standard content types and handlers), you could export the view to code and post here.

drupalshrek
Please fill in my Learning a foreign language questionnaire if you have a moment.

jag1500’s picture

Thanks for helping. Below is the Exported view. Basically I created a Taxonomy called Location. I created a view called City and added the Location vocabulary in there. I try to set the exposed checkbox but it remains unchecked even after saving.

$view = new view();
$view->name = 'city';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'City';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'City';
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: City (field_city) */
$handler->display->display_options['filters']['field_city_tid']['id'] = 'field_city_tid';
$handler->display->display_options['filters']['field_city_tid']['table'] = 'field_data_field_city';
$handler->display->display_options['filters']['field_city_tid']['field'] = 'field_city_tid';
$handler->display->display_options['filters']['field_city_tid']['value'] = '';
$handler->display->display_options['filters']['field_city_tid']['vocabulary'] = 'location';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'city';

jag1500’s picture

Even if I try to expose the published field, it does not stick.

boban_dj’s picture

Hi,
Did you add a field for the taxonomy terms in the field of the content type.?
This field you have to refer to in the view, when you add the filter criteria.
search for taxonomy and their will be 3 options. One taxonomy, taxonomy with depth, and your taxonomy that appears in the location content type field. choose this

you add it in the add filter criteria, settings > just check at the top: Expose this filter to visitors, to allow them to change it
Leave all the others like it is.
Then save the view and it works fine.

goodluck

Boban_dj

jag1500’s picture

Yes, I added the field called field_city. I add this field to the filter criteria. When i check the checkbox and click save, the expose text does not show up next to my filter criteria. when i go back to edit it, the "Expose this filter to visitors, to allow them to change it" remains unchecked.

boban_dj’s picture

Hi,
I try to debug step-by-step:

could you tell me if you made the field type of field_city a Term reference, in your content type.
my widget is a select list, and make sure the vocabulary (in the edit settings of the field) it is using is the taxonomies you set up. (mine i called location, this dropdown should show up in you content)
Do you see the taxonomy term show up in your content?

I have a content type of players with a field location linked as a term reference to the taxonomy , with content about a footballplayer, my tax terms are cities, and the taxonomy Vocabularies is called Location, with the terms: amsterdam, london berlin (etc)

from the comparison below, i see you have not a filter for the content type. You must add this filter also, so it can show up in you view.
(## = this is my comment)

## here are the settings of the fiel criteria, after adding this field to the filter criteria is shows up:
under setting i have dropdown and below you see the settings of the field citeria itself:

Content: location_tax_term (exposed) | Settings

Appears in: node:players.

<strong>## checked: Expose this filter to visitors, to allow them to change it</strong>
Filter type to expose
<strong>## checked: Single filter</strong>
Grouped filters
Grouped filters allow a choice between predefined operator|value pairs.
Required
Label

Description
<strong>## next to the description you see the list with the cities from the taxonomy</strong>

Operator
<strong>## only this checked: Is one of  </strong>
Is all of
Is none of
Is empty (NULL)
Is not empty (NOT NULL)
Select terms from vocabulary Location

Expose operator
Allow the user to choose the operator.
Allow multiple selections
Enable to allow users to select multiple items.
Remember the last selection
Enable to remember the last selection made by the user.
Limit list to selected items
If checked, the only items presented to the user will be the ones selected here.
<strong>## only this checked</strong>
Display error message
Reduce duplicates
This filter can cause items that have more than one of the selected options to appear as duplicate results.

## I compared my view with your view:

I commented (## like so) in the lines so there you can see some differences. I think the main difference like I said above, I dont see the filter for the content show up.
For the taxonomy field yes, but you need to filter as well or else the exposed filter has nothing where it could appear.

boban ~/Documents $ colordiff view_yours view_mine

## > this is my view
## < that is you view

6c6
## mine is called city, ok

< $view->human_name = 'City';
---
> $view->human_name = 'city';

13,14c13
## you have ajax why?

< $handler->display->display_options['title'] = 'City';
< $handler->display->display_options['use_ajax'] = TRUE;
---
> $handler->display->display_options['title'] = 'city';

16c15
## change your permission that everybody can see it, middle column of the view
< $handler->display->display_options['access']['type'] = 'perm';
---
> $handler->display->display_options['access']['type'] = 'none';

20,21c19
## you have a pager, ok
< $handler->display->display_options['pager']['type'] = 'full';
< $handler->display->display_options['pager']['options']['items_per_page'] = '10';
---
> $handler->display->display_options['pager']['type'] = 'none';

23a22
> $handler->display->display_options['row_options']['view_mode'] = 'full';
43,48c42,65

## you filter criteria
< /* Filter criterion: Content: City (field_city) */
< $handler->display->display_options['filters']['field_city_tid']['id'] = 'field_city_tid';
< $handler->display->display_options['filters']['field_city_tid']['table'] = 'field_data_field_city';
< $handler->display->display_options['filters']['field_city_tid']['field'] = 'field_city_tid';
< $handler->display->display_options['filters']['field_city_tid']['value'] = '';
< $handler->display->display_options['filters']['field_city_tid']['vocabulary'] = 'location';
---

## my filter criteria
> /* Filter criterion: Content: Type */
> $handler->display->display_options['filters']['type']['id'] = 'type';
> $handler->display->display_options['filters']['type']['table'] = 'node';
> $handler->display->display_options['filters']['type']['field'] = 'type';
> $handler->display->display_options['filters']['type']['value'] = array(
>   'players' => 'players',
> );

## this part doesn't show up in your view, it is the expose
> /* Filter criterion: Content: location_tax_term (field_location_tax_term) */
> $handler->display->display_options['filters']['field_location_tax_term_tid']['id'] = 'field_location_tax_term_tid';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['table'] = 'field_data_field_location_tax_term';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['field'] = 'field_location_tax_term_tid';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['exposed'] = TRUE;
> $handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['operator_id'] = 'field_location_tax_term_tid_op';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['label'] = 'location_tax_term (field_location_tax_term)';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['operator'] = 'field_location_tax_term_tid_op';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['identifier'] = 'field_location_tax_term_tid';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['remember_roles'] = array(
>   2 => '2',
>   1 => 0,
>   3 => 0,
>   4 => 0,
> );
> $handler->display->display_options['filters']['field_location_tax_term_tid']['type'] = 'select';
> $handler->display->display_options['filters']['field_location_tax_term_tid']['vocabulary'] = 'location';

52a70,75
## this is the view with a menu link called city in the main menu
> $handler->display->display_options['menu']['type'] = 'normal';
> $handler->display->display_options['menu']['title'] = 'city';
> $handler->display->display_options['menu']['weight'] = '6';
> $handler->display->display_options['menu']['name'] = 'main-menu';
> $handler->display->display_options['menu']['context'] = 0;
> $handler->display->display_options['menu']['context_only_inline'] = 0;

## This is my view export, here the export:

$view = new view();
$view->name = 'city';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'city';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'city';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['row_options']['view_mode'] = 'full';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'players' => 'players',
);
/* Filter criterion: Content: location_tax_term (field_location_tax_term) */
$handler->display->display_options['filters']['field_location_tax_term_tid']['id'] = 'field_location_tax_term_tid';
$handler->display->display_options['filters']['field_location_tax_term_tid']['table'] = 'field_data_field_location_tax_term';
$handler->display->display_options['filters']['field_location_tax_term_tid']['field'] = 'field_location_tax_term_tid';
$handler->display->display_options['filters']['field_location_tax_term_tid']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['operator_id'] = 'field_location_tax_term_tid_op';
$handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['label'] = 'location_tax_term (field_location_tax_term)';
$handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['operator'] = 'field_location_tax_term_tid_op';
$handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['identifier'] = 'field_location_tax_term_tid';
$handler->display->display_options['filters']['field_location_tax_term_tid']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
  3 => 0,
  4 => 0,
);
$handler->display->display_options['filters']['field_location_tax_term_tid']['type'] = 'select';
$handler->display->display_options['filters']['field_location_tax_term_tid']['vocabulary'] = 'location';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'city';
$handler->display->display_options['menu']['type'] = 'normal';
$handler->display->display_options['menu']['title'] = 'city';
$handler->display->display_options['menu']['weight'] = '6';
$handler->display->display_options['menu']['name'] = 'main-menu';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;

Boban_dj

Sam Moore’s picture

Last year I had some issues with jQuery Update breaking ViewsUI - perhaps changing your jQuery version will help?
Here's a thread about that: https://www.drupal.org/node/1869988
Also https://www.drupal.org/node/2176199

Failing that, Views' issue queue is well patrolled by the Views Bug Squad.
https://www.drupal.org/node/945414
Your issue is likely with the ViewsUI component.

jag1500’s picture

I did not have JQuery update, I installed that module. I set the JQuery to v1.5, no luck.

If anyone would like to have admin password to my installation. I can send it via private message or email.

jag1500’s picture

Yes, I set it as you mentioned and the taxonomy field shows up in my content type. To keep things simple. The published filter which appears as default when creating a view does not get exposed either.

Sam Moore’s picture

I switched your Admin theme to Seven and the Views UI interface is behaving as desired now (though I think I garbled your view a bit - sorry about that).
Your theme has something going on in it which messes with Views UI, possibly at the Javascript level.

You can keep using Seven as your admin theme and leave Vezit as your userland theme, or you can figure out what's wrong with Vezit and fix it - your choice :-)

boban_dj’s picture

Hi,
I fumbled around and fixed the exposed filter.
I made a new view city-2, added the exposed filters city and city 2. You have to browse to vezit.com/city-2

You did not have a city field in your content type for making the term reference from the taxonomy. So it shows not up in the views options as adding at as a filter.

I saw that you have ajax enabled, i disabled this. No particular reason just checking. The Jquery-update module, has nothing todo with it. I had problems with views and jquery update module, but it was fixed a while ago. But i saw you have tax menu module, I had problems as well I disabled it.
It is sometimes confusing when adding term reference, but I always name them so I can see them clearly in the filter, when adding it in the view.

I don't know if you want the expose filter to show up in the primary menu, as shown in your block. This is maybe a specific theme menu function.

I enabled the normal drupal menu block in the menu region, so you see the view city-2 with menu and home.
If you click your menu "home" from the primary menu, you see a teaser referenced from your field category (restaurant, bakery, coffee& tea)
this is not a view so you dont see an exposed filter option.

when you click read more from the teaser, you see the actual content.
As far as i know from the view only you can see the filter exposed option, as you see in /city-2 view.

I hope you don't mind i fumbling around in your site with images. so bloody tempting to add an image.
goodluck

Also tax-menu module is nice but be aware it can remove menu's so be careful.

Boban_dj

jag1500’s picture

Boban_dj, Thank you for your help,I thought I added the field to the content type, maybe i did not. Thanks for catching that and thank you for spending time on this. I do not mind you tinkering with the site or adding images, nice touch!

Question: If I have the city exposed filter as a block, which i do now. how can i get it to stick to the city the visitor selected as the visitor browses though restaurants, bakeries or other menu options. So, basically, the menu displays items for the selected city. If i change the city, the menu option displays results of the city that is now selected and the city filter sticks as long as visitors are browsing through the menu.

Thanks again for the help.

boban_dj’s picture

Hi,
what is the exact goal or purpose of the site, I mean what does the user have to find and what do you want them to find eventually.
If you could think about it in a broad sense(helicopter view).
Then you can decide what to use for the content-search structure and it will be easier. then ask the question again.

Maybe you could play around tith entity reference field, so you have a more finegrain control of the output and use tools like blocks and views for the bigger picture.
It is like make the foundation of your house with big and strong materials, and use the same materials for making your furniture.
it can be done but so effective.(or maybe you like the Flintstones ;)

Have a look at panels to: https://www.youtube.com/watch?v=_br951M-UqQ (it has a nice explanation about entity reference and panels. it is a series of video tuts, so you want to watch from the beginning of panels)

There are many ways to fine grain your drupal setup.
goodluck

Boban_dj

jag1500’s picture

Thanks Boban_dj, I have posted the question in detail here: https://www.drupal.org/node/2327367

jag1500’s picture

Thank you Sam Moore for your help, yes when i did enable my own theme for administration, i got an error, i should have kept the seven theme. Thanks again for spending time on this.