Hi, apologised if there's similar issue like this posted before.

Anyway, there's a slight problem where there's additional "&" (ampersand) appear in the paging URL every time I added exposed filter with multiple selection, so the URL to go to the next page would be something like this below:

http://testdomain.dev/test-test?&&&page=2

Please see image screenshot for reference.

The problem it's on ver. 7.x-3.7, but still occur even after I upgraded to 7.x-3.8.

Anyone encounter this before? and what could be the solution?
Thanks in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ardnet’s picture

Issue summary: View changes
ardnet’s picture

Issue summary: View changes
diquinnyonk’s picture

having the exact same issue! no idea when I click on a pager it throws the extra &&&& in.
If I remove them all page still loads relevant stuff.

no idea currently. Hope someone has an idea

nkanderson’s picture

nkanderson’s picture

I'm running into this issue using Views 7.x-3.11 and Panels 7.x-3.5, with an exposed form in one panel pane and a view with an attached view in another panel pane. The unnecessary ampersands in the pagination links are coming from line 90 in views/theme/theme.inc: $vars['pager'] = $view->query->render_pager($exposed_input);

In troubleshooting, if I pass in an empty array instead of $exposed_input, the pager links render as expected, and the exposed filter parameters are added correctly to the pagination links. I'm not sure what the ultimate solution is, but will post back if I dig into it enough to find out.

fox mulder’s picture

The issue still exists using Views 7.x-3.13 and Panels 7.x-3.5

jfurnas’s picture

During my testing, I discovered that $exposed_filters was always returning true, even if no exposed filters were selected. This resulted in a multi-level array of empty values, therefore evaluating $exposed_filters to true all the time. The fix loops through the $exposed_filter array, and removes any empty arrays, and if the entire array is empty, results in an empty array, causing the extra &'s to be removed as well.

jfurnas’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: [2276889].patch, failed testing.

jfurnas’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: [2276889].patch, failed testing.

jfurnas’s picture

Status: Needs work » Needs review
FileSize
475 bytes

Last patch failed for some reason, trying a new one.

Status: Needs review » Needs work

The last submitted patch, 12: 2276889.patch, failed testing.

jfurnas’s picture

Status: Needs work » Needs review
FileSize
530 bytes

Status: Needs review » Needs work

The last submitted patch, 14: 2276889.patch, failed testing.

jfurnas’s picture

Status: Needs work » Needs review
FileSize
530 bytes

Sorry guys, i'm new to this.

Status: Needs review » Needs work

The last submitted patch, 16: views-2276889.patch, failed testing.

jfurnas’s picture

Status: Needs work » Needs review
FileSize
535 bytes

Status: Needs review » Needs work

The last submitted patch, 18: views-2276889.patch, failed testing.

joshi.rohit100’s picture

FileSize
23.06 KB

It is failing due to the second callback paramater. Even its failing on my local

jfurnas’s picture

I have given up attempts to solve this issue. I have been unable to replicate this error on any drupal installation I have, and I have tested it on 10 to this point.

joshi.rohit100’s picture

i will give it a try.

cbeier’s picture

A small workaround for the problem:

// Workaround for views issue:
//   * https://www.drupal.org/node/2738317 (Wrong exposed filter value at boolean/checkbox fields after used pagination)
//   * https://www.drupal.org/node/2276889 (Exposed filters with multiple selection causing additional parameter in the paging URL)

/**
 * Implements theme_preprocess_pager_link().
 */
function MODULE_preprocess_pager_link(&$variables) {
  if (isset($variables['parameters'])) {
    foreach ($variables['parameters'] as $key => $value) {
      // Remove all empty/false parameters from url.
      if (empty($value)) {
        unset($variables['parameters'][$key]);
      }
    }
  }
}
zalak.addweb’s picture

Issue tags: +views
riddhi.addweb’s picture

Issue tags: +exposed filter
Sergei Churilo’s picture

Sergei Churilo’s picture

FileSize
811 bytes

del

Sergei Churilo’s picture

djdevin’s picture

Version: 7.x-3.7 » 7.x-3.18
Component: Miscellaneous » exposed filters

This still happens and messes up some web crawlers as they don't understand the "?&&" in the URL for the clicksort/pager links. They start going in loops.

10.131.0.1 - - [27/Feb/2018:04:44:36 +0000] "HEAD /courses?amp%3B=&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Border=field_course_event_date&amp%3Bamp%3Bsort=asc&amp%3Border=field_course_event_date&amp%3Bsort=asc&&&order=field_course_event_date&sort=asc HTTP/1.1" 200 - "http://x.x.x/courses?amp%3B=&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Bamp%3Border=title&amp%3Bamp%3Bamp%3Bsort=asc&amp%3Bamp%3Border=field_course_event_date&amp%3Bamp%3Bsort=asc&amp%3Border=field_course_event_date&amp%3Bsort=asc&&&order=field_course_event_date&sort=asc" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36"

The patches fix the pager, but clicksort is also broken.

This is very easy to reproduce:

1. Install Drupal
2. Enable views_ui
3. Add a select field to basic page content with some options
4. Create a bunch of basic pages
5. Create a table view of basic pages
6. add a filter with the field in #3
7. Set that filter to exposed, allow multiple options
8. Edit the table's settings and enable clicksort on some fields
9. Go to the view and check out the clicksort/pager links. They will look like ?& with a & being added for every multiselect filter.

EDIT:

Correction, the pager is fixed in 3.16 #2315365: Pager should be built with view::get_exposed_input(), not $view->exposed_raw_input.

Clicksort is still broken.

djdevin’s picture

Title: Exposed filters with multiple selection causing additional parameter in the paging URL » Exposed filters with multiple selection causing additional parameter in the clicksort URL
Version: 7.x-3.18 » 7.x-3.x-dev
Status: Needs work » Closed (duplicate)
djdevin’s picture

Title: Exposed filters with multiple selection causing additional parameter in the clicksort URL » Exposed filters with multiple selection causing additional parameter in the pager URL
apaderno’s picture

Issue tags: -views, -exposed filter