I'm having a content pane with exposed filters and 'Use Panel path' set. When submitting the filters, the page is redirected to a wrong URL (some ids are appended to the original path and then ?filter_name=value).
The same was e.g. reported in http://drupal.org/node/1168088#comment-4542450, but the issue actually was dealing with exposed form blocks, which I'm not using.

Comments

merlinofchaos’s picture

Category: bug » support
Status: Active » Fixed

Views automatially appends arguments (contextual filters) to the path. I believe there is a checkbox in the contextual filter to disable that behavior. You'll want ot use that.

mh86’s picture

Status: Fixed » Active

Thanks for the information.
I set 'Skip default argument for view URL' in my arguments, but still the values are appended to the URL. Did I miss something?

mh86’s picture

Well, as the option says, it only applies for default arguments. Is there any other option for arguments passed via the panels context?

andypost’s picture

Hit this bug. A bit of investigations - if View inserted into context then $view->override_path is empty

Suppose "override_path" should be set for context'ed view before views_content_context_get_output() is executed, but I still not found a right place to patch

andypost’s picture

Status: Active » Needs review
StatusFileSize
new586 bytes

This is a hack but it works

To test this
1) add a view with exposed form into panel's context
2) add exposed form to panel
3) try to submit form

without patch you will be redirected to site's frontpage

mh86’s picture

Status: Needs review » Needs work

Have you tried to use the 'Use Panel path' setting? I think that is what you are looking for.
I tested your patch and doesn't make a difference for me, after submitting the exposed filter, the additional contextual filter values (passed from the page manager) are appended, leading to a page not found.

andypost’s picture

Status: Needs work » Needs review

@mh You mean exposed form from Paged view, but I'm talking about context-view - neither context nor exposed form has 'Use panel path' checkbox

Steps to reproduce:
1) create a view with ONLY context display & exposed filters
2) drop this context into panel
3) drop rows and exposed form into panes
4) try to use exposed filter

mh86’s picture

Yes, I'm using Content panes. But still, there should be a 'Use panel path' in the Context settings.

andypost’s picture

Status: Needs review » Fixed

I found 'Use panel path' in the Context settings and everything works fine

mh86’s picture

Status: Fixed » Active

The original issue was about a different problem - so I re-open it.
When having a context pane that pulls arguments from a page manager page, the submitted exposed form appends the arguments to the URL, leading to a page not found.

merlinofchaos’s picture

Status: Active » Closed (won't fix)

That is not a CTools problem, that is a problem in Views.

mstrelan’s picture

Title: Exposed filters in panels page do not work » Exposed filters submit erroneously appends Views arguments to page manager page paths
Project: Chaos Tool Suite (ctools) » Views (for Drupal 7)
Version: 7.x-1.x-dev » 7.x-3.x-dev
Component: Views Content » exposed filters
Category: support » bug
Status: Closed (won't fix) » Active
StatusFileSize
new3.8 KB
new13.14 KB

#11 clearly states this is a bug in Views. #10 describes the issue. I've attached an export of my view and an export of my page. The exposed filter block is added via block.module. My exact steps to reproduce.

1. Import the view and page attached.
2. Show the exposed filter block on the path volunteering/vacancies
3. Visit the path volunteering/vacancies
4. Submit the exposed filters
5. You are now at volunteering/vacancies/volunteering?keys= ....

My page manager page is already supplying the argument to views, why is views adding it again?

I could of course rearrange my URLs so they read vacancies/volunteering and vacancies/employment but semantically this makes less sense for my particular site, because the site has an entire section about employment (with path "employment") and an entire section about volunteering (with path "volunteering") but does not have a section about vacancies, that is a subsection of the above two.

mh86’s picture

Status: Active » Closed (duplicate)

I've created an issue for Views some time ago, which can be seen here #1284738: Wrong form action URL for exposed filters of content pane view displays using contextual filters.
There is a patch available that basically works, but it is definitely a hack. So it still needs to be fixed in a proper way (which likely needs to be done in the CTools views plugins).

ayalon’s picture

The bug still exists....

Another workaround is to activate AJAX. Then it works too..

johnpitcairn’s picture

Title: Exposed filters submit erroneously appends filter value to paths » Exposed filters submit erroneously appends Views arguments to page manager page paths
Status: Active » Closed (duplicate)

I don't think this is limited to page manager displays. Anything that embeds a view into an existing path may have the same behavior.

I'm using the view_reference module to embed a view that has an exposed filter into a node - views will append the current filter argument to the node path when submitting a new filter value, ie:

node/345/current-filter-value?filter=new_value

This still displays the node and view, but if you have blocks etc that depend on the path you'll need to allow for the extra argument to the path in the block setup, which may become hard to handle.

I haven't tested with EVA but I suspect this may be an issue there as well.

johnpitcairn’s picture

Title: Exposed filters submit erroneously appends Views arguments to page manager page paths » Exposed filters submit erroneously appends filter value to paths
Status: Closed (duplicate) » Active

I'm reopening this because contextual filters are not involved (my view uses none). Changing title to reflect the more general case.

Workaround I'm going with is something like this:

function mymodule_form_views_exposed_form_alter(&$form, &$form_state) {
  switch ($form['#id']) {
    case 'views-exposed-form-viewname-displayname':
      // Workaround for #1269794.
      // Whatever you need to make it behave, but remove the added filter argument.
      $form['#action'] = 'my-path';
      break;
  }
}
steinmb’s picture

Title: Exposed filters submit erroneously appends Views arguments to page manager page paths » Exposed filters submit erroneously appends filter value to paths
Status: Closed (duplicate) » Active
StatusFileSize
new23.62 KB

It is this line as #16 that causes 'problems'.

<?php
$form['#action'] = url($view->display_handler->get_url());
?>

The problem

Views try to find it's own path. Since the views it not the one that make the page with URL rather it is made by page manager. get_url() return an empty string. url() function resolve this to '/' causing the submit button action to be '/' something that normally is your front page.

The fix

To get around this do you have to change/add a 'content page' and let page manager pull this in. The trick is a small setting in 'content pane' pane settings 'Use panel path'.
panels path

johnpitcairn’s picture

That's not much use if you aren't using panels.

steinmb’s picture

Eh.. no but that was not the point either. Do you care to share your setup?

johnpitcairn’s picture

Just views, and hook_form_alter as per #16. How you manipulate the #action variable there will depend on what the path looks like, but I use substr() or preg_replace(). It's a hack, not a generic solution.

steinmb’s picture

OK, but I was thinking more along, how and where do you use this view? since views have trouble getting the url. Is it a Views page, a block used by core blocks, view attached to a node and so on?

johnpitcairn’s picture

Mine is a block used by core blocks, grabbing its contextual filter values (nid) with a line of php. I have not yet experimented with EVA to see if attaching the view to the node that way produces the same problem.

othermachines’s picture

Thanks, John Pitcairn. #16 worked well for me (with contextual filters). Just wrapped the path in url() and all good to go.

.. snip ..
      $form['#action'] = url('my-path');
hnln’s picture

same problem here:

* view as context (use panel path: yes) and the view has an argument (provided through the panel)
* panel with the exposed filters and the view rows

on every submit over the exposed filters the argument is added again to the url, resulting in a panel_path/argument/argument/argument/argument/... path.

(d7 with the latest versions of views, ctools and panels)

nicholasthompson’s picture

A slight variation on #16 is:

      $form['#action'] = url(current_path());

Avoids hard coding the view URL into your alter.

andypost’s picture

Is D8 affected by this? so maybe better to move the issue to core?

micnap’s picture

I just ran into this problem using eva. I have a view with an exposed filter that gets attached to an entity of type organization. The path of the entity is redhen/org/12345. Each time I submit the form on the exposed filter, I get 12345 appended to the end of the url. Worked around it with the hook_form_alter suggestions from #16 and #25.

jojonaloha’s picture

Issue summary: View changes
StatusFileSize
new1.03 KB

I think this effects more then just the exposed filter forms.

Some other examples of where this happens:

  • more link
  • in the form action for other views handlers that implement views_form() (example: draggableviews)
  • glossary filter links

I think these issues could all be summarized as: Views Contextual Arguments are appended to various paths of Panel Pane displays when "Use Panel Path" is set to "Yes".

See also:
#1284738: Wrong form action URL for exposed filters of content pane view displays using contextual filters
#1449248: When using "Override path" and an argument with "input on pane config", the argument is appended to the overridden path
#2213005: Argument repeatedly appended to URL on glossary views content panes

I'm attaching a patch that I think fixes this without requiring custom form_alters().

jojonaloha’s picture

Project: Views (for Drupal 7) » Ctools
Version: 7.x-3.x-dev »
Component: exposed filters » Code

Patch is for ctools, moving to that issue queue.

jojonaloha’s picture

Project: Ctools » Chaos Tool Suite (ctools)
Version: » 7.x-1.x-dev
Component: Code » Views Content

Wrong project...

a.milkovsky’s picture

@steinmb, thanks for #17