When I expose the "Items Per Page" filter on the pager, I get this on-screen error:
An illegal choice has been detected. Please contact the site administrator.

And this in the error log:
Illegal choice 100 in Per page element.

It happens with both the full and mini pager. It doesn't show on initial page load, only after the Apply button is clicked.

This may be a duplicate of #1177882: Exposed filters fire "An illegal choice has been detected. Please contact the site administrator." error, I wasn't sure since it only involves the pager filter, the 4 other exposed filters work fine until this is added.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Can you export please a view which is reusable? This would be great and your 50% to fix the bug :)

OldAccount’s picture

FileSize
43.71 KB

Oops, my apologies. Here's the exported view, hope that helps.

OldAccount’s picture

Status: Postponed (maintainer needs more info) » Active

Exported view provided in previous comment, forgot to change status back to active.

dawehner’s picture

Mh this export is quite complex so it's not possible to reuse, but it gives some informations. I tryed to rebuild a view based on this, but sadly it works as expected.


$view = new view;
$view->name = 'blubber';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'blubber';
$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'] = 'blubber';
$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['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '50';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['expose']['items_per_page'] = TRUE;
$handler->display->display_options['pager']['options']['expose']['items_per_page_options'] = '50,100,150,200';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = 0;
$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']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* 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'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'blubber';
dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

So i can't reproduce the problem :(

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
tobiasb’s picture

Status: Closed (cannot reproduce) » Active

Needs a validation, that the value of the option "Items per page" is also in list "Exposed items per page options".

dawehner’s picture

Status: Active » Needs review
FileSize
1.08 KB

Thanks for this excellent hint! Here is a patch which validates the settings.

tobiasb’s picture

Status: Needs review » Needs work

Patch from #8 works for me.

+++ b/plugins/views_plugin_pager_full.inc
@@ -165,6 +165,16 @@ class views_plugin_pager_full extends views_plugin_pager {
+        form_set_error('pager_options][expose][items_per_page_options', t('Please insert the items per page(@items_per_page) from above.',

perhaps a whitespace before (@items_per_page) would be nice ;-)

dawehner’s picture

Status: Needs work » Needs review
FileSize
1.08 KB

Oh right this looks kind of odd

tobiasb’s picture

Status: Needs review » Reviewed & tested by the community

Nice ;-)

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the review and the perfect line

Committed to 7.x-3.x and 6.x-3.x

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

adding additional error msg and fixing issue link