I have a block view that lists all nodes of a site section with an exposed filter by taxonomy term widget(for alphebetical sorting). It is displayed on all pages in the right sidebar. I also have a page view so that user can sort nodes by category, again with an exposed filter by term widget, where they recieve more detailed teasers instead of a simple node title list.

When I navigate to the page view, select a filter, and apply it, drupal returns this error:

"An illegal choice has been detected. Please contact the site administrator."

and it highlights the dropdown filter widget on the block view like the two are being confused somehow by drupal. The same does not occur when I apply a filter option to the block view instead of the page view.

Both views still return the proper results, it's just that the page view reports the illegal choice error as long as the block view is present in the sidebar. If I remove the block view from the sidebar, the page view no longer reports the error. Any ideas as to why this occurs?

Thanks for reading.

Comments

highvoltage’s picture

I tinkered around with it a bit and I found that the error ceases to occur when i enable AJAX on the page view, so whatever the problem is, I guess it's related to the reloading of the page when submitting a filter. That seems strange to me since the page view loads fine when you first navigate to the page.

Also, here are the exported views in question.

Page view:

$view = new view;
$view->name = 'anime_categories';
$view->description = 'Teaser list of all anime by category';
$view->tag = 'index';
$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',
  ),
));
$handler->override_option('filters', array(
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '47' => '47',
      '53' => '53',
      '55' => '55',
      '49' => '49',
      '52' => '52',
      '54' => '54',
      '59' => '59',
      '57' => '57',
      '60' => '60',
      '50' => '50',
      '62' => '62',
      '48' => '48',
      '63' => '63',
      '61' => '61',
      '51' => '51',
      '56' => '56',
    ),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'tid_op',
      'identifier' => 'tid',
      'label' => '',
      'optional' => 0,
      'single' => 1,
      'remember' => 0,
      'reduce' => 0,
    ),
    'type' => 'select',
    'vid' => '6',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 0,
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('empty', 'Sorry, no results found.');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 15);
$handler->override_option('use_pager', '1');
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'anime-categories');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));

block view:

$view = new view;
$view->name = 'Anime_menu';
$view->description = 'Alphabetically sortable anime menu';
$view->tag = 'menu';
$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',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '6' => '6',
      '9' => '9',
      '10' => '10',
      '11' => '11',
      '17' => '17',
      '12' => '12',
      '13' => '13',
      '15' => '15',
      '16' => '16',
      '18' => '18',
      '19' => '19',
      '20' => '20',
      '21' => '21',
      '22' => '22',
      '23' => '23',
      '24' => '24',
      '25' => '25',
      '26' => '26',
      '27' => '27',
      '28' => '28',
      '29' => '29',
      '30' => '30',
      '31' => '31',
      '32' => '32',
      '33' => '33',
      '34' => '34',
      '35' => '35',
    ),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'tid_op',
      'identifier' => 'tid',
      'label' => '',
      'optional' => 0,
      'single' => 1,
      'remember' => 1,
      'reduce' => 0,
    ),
    'type' => 'select',
    'vid' => '2',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 0,
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'anime' => 'anime',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('empty', 'Sorry, no results found');
$handler->override_option('empty_format', '1');
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 99);
$handler->override_option('use_pager', '1');
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
merlinofchaos’s picture

Status: Active » Fixed

This is likely the block view trying to interpret the filters in a way that leads to Form API through that error.

highvoltage’s picture

Thanks for responding, but I'm not sure what to make of that. Is that proper behavior? Are page views and block views with exposed filters not designed to exist on the same page?

merlinofchaos’s picture

They are not; block views shoudl only have exposed filters if they use ajax.

highvoltage’s picture

The block view was using ajax. It's the page view that was not using ajax. The error occurs when submitting an option for the exposed page view filter, not the block view. Does that change anything?

merlinofchaos’s picture

Go through your exposed filters. Make sure they do not share any identifiers. Any identifier with the same name will be read by both views.

highvoltage’s picture

Yes, they both shared the same identifier "tid", I changed the block views identifier and it works perfectly.

Thanks!

Status: Fixed » Closed (fixed)

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