Closed (fixed)
Project:
Views Bulk Operations (VBO)
Version:
7.x-3.x-dev
Component:
Core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Dec 2011 at 19:22 UTC
Updated:
24 Oct 2012 at 11:51 UTC
Hi!
I have some pretty unexpected behaviour going on.
What happens is, after executing an action, any argument in the path is appended to the URL. For example, if I have a view at node/12/widgets, and I submit it, the path goes to node/12/widgets/12. For some views, it is appended a few times, i.e. node/12/widgets/12/12/12 (after one submit).
Why does this happen? I'm not sure. The view is in a panel, and the panel takes an argument of %node. I believe it's the combination of views and panels which messes it up.
View attached.
| Comment | File | Size | Author |
|---|---|---|---|
| export.txt | 17.64 KB | nagiek |
Comments
Comment #1
bojanz commentedDo any of the solutions at #1226284: VBO not working when the current URL is not the same as the view's URL (e.g. when in a Panel or Quicktab) help?
Comment #2
nagiek commentedI'm already using the Use Panels Path option, but I haven't tried overriding the path directly.
Will let you know.
Comment #3
nagiek commentedI tried using the Override Paths option, and it did have an effect, but it didn't solve the problem completely.
Observations:
Thanks
Comment #4
nagiek commentedDid some more research, and noticed the #action property in the form is not built correctly: it has the argument appended, thus when you submit it goes to the url.
That should fix it.
Comment #5
mstrelan commentedSounds similar to #1284738: Wrong form action URL for exposed filters of content pane view displays using contextual filters, possibly related?
Comment #6
g089h515r806 commentedI have the same issue,
companycenter/22/events,
companycenter/22/events/22
companycenter/22/events/22/22
companycenter/22/events/22/22/22
....
Comment #7
bojanz commentedCan you retest with latest dev (7.x-3.x-dev)? I committed a fix for embedded Views that might help.
Comment #8
drbartje commentedI also have this issue. Using views_bulk_operations-7.x-3.0-beta3. I am not using Panels. The views is embedded in a node as a tab. I would expect the right value to be 'action="/drupal/node/NID/MYTAB/"' but instead I get 'action="/drupal/node/NID/MYTAB/NID"' and each time the form is submitted "/NID" is appended...
The view has a contextual filter and uses AJAX.
I've tried views_bulk_operations-7.x-3.x-dev but in this case I get 'action="/drupal/"' instead of 'action="/drupal/node/NID/MYTAB/"'.
If you need additional info please let me know.
Update
definitively related to the use of a contextual filter. I embed the view using
print views_embed_view('MYVIEW', 'block', $node->nid);If I leave off the last parameter then things works as expected, i.e., 'action="/drupal/node/NID/MYTAB/"' and the node ID does not get appended. Of course, doing so I have too many entries in my view so not an option.
Strangely enough, even if I forcefully correct the form action to 'action="/drupal/node/NID/MYTAB/"' (e.g. by implementing hook_form_alter) then after submitting the form the node ID still gets appended. At least in doing so it gets appended only once and not endlessly...
I have tried using the "Skip default argument for view URL" option for the contextual filter but that doesn't solve the issue...
Comment #9
bojanz commentedYou need to test with VBO 7.x-3.x-dev AND a recent Views version (3.3 is fine).
If you tried just the latest VBO without the recent Views, you wouldn't get the desired results.
Let me know if that changes anything, and I'll try to reproduce this anyway.
Comment #10
drbartje commentedI am using Views 7.x-3.3.
I've just tried again with VBO 7.x-3.0-rc1+14-dev.
When I examine the form in my hook_from_alter function (which runs after VBO and Views) then I see that $form['#action'] is set to '/drupal/'. As a result I am redirected to the site's landing page when I submit the form.
If I set $form['#action'] to '/drupal/node/NID/MYTAB/' in hook_from_alter then I do no longer get the erroneous additional node IDs in the URL. So at least I now have a way to make this work but it doesn't feel quite right... -> I must be doing something wrong... :-(
(btw thanks for an outstanding module and exemplary responsiveness!)
Comment #11
damiankloip commentedI am looking at the form too, I have tested on pages, tabs etc... and the #action seems to be correct from what I can see. Maybe this has been resolved by some earlier commits as bojanz suggested ^^ ? If not, do you have specific step to reproduce this?
Comment #12
nagiek commentedI haven't run into it either, yet. Running the latest.
If I encounter it I'll let you know, but haven't so far. I have no idea when it actually stopped appearing. :)
Comment #13
nagiek commentedOops just kidding. Still happens. Running latest.
Comment #14
a.milkovskyI've found a solution how to avoid this problem.
I deleted my Contextual Filter and created ordinary Filter Criteria using PHP code.
I wanted to get user id from URL so I typed
And problem with form action gone.
To insert PHP into Filter Criteria i user module Views PHP
Comment #15
erichomanchuk commentedI have the same issue when using views_bulk_operations 7.x-3.0-rc1.
biz/customers/15
biz/customers/15/15/15
biz/customers/15/15/15/15/15/15
I'm adding the view block to the page with views_embed_view() and setting views to use AJAX.
When I upgrade to views_bulk_operations 7.x-3.x-dev version the form action is then set to / and it doesn't work only when I set the $form['#action'] = '/biz/customers/15' by using hook_form_alter like DrBartje suggested in comment #10 does it function properly.
Comment #16
nagiek commentedTime to fix some bugs.
What's wrong:
$form['#action']is set explicitly. It calls$view->get_url(). This is where it's going wrong.Normally,
$view->get_url()will take the wildcards (denoted with%) and replaces them. However, the path it is receiving has already been replaced. (i.e. it's getting widgets/12, not widgets/%), so it has nothing to replace, and instead appends the args on the end. This results in the appended url problem.Where it gets weird:
I believe (correct me if I'm wrong) that this is only happening for VBOs in panels. Which means
views_content_plugin_display_panel_paneis responsible for generating the path.The thing is, I have no idea how it's doing that. Every time i check for a return value, it says it's
NULL. It tries to run its parent class,views_plugin_display, but that's not returning anything either. Maybe there's something override somewhere that just grabs$_GET['q']?I don't know, need some help.
Options:
We could either:
view->get_url()toview->get_path(), but I think that would break non-panel paths%operator).I think #3 is the only option, assuming that only Panel views are being affected. If not, we have to fix views.
Comment #17
maxplus commentedHi,
I have the same problem and the problem also dissapears when removing the contextual filter.
I tried the current dev version of views (2012-Jun-09) and VBO (2012-Jun-04) but then other strange things happen.
So the only current solution is to use a regular filter and modify it with php to create your own contextual filter like a.milkovsky posted in #14.
Comment #18
maxplus commentedHi guys,
a short update.
While trying to use a regular php filter to achieve my goal, I just tried my original contextual filter once again with with one slight change:
I enabled " Skip default argument for view URL: Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds."
Now it is working fine, great!
Comment #19
nagiek commentedI'm starting to think this is a duplicate of #1284738: Wrong form action URL for exposed filters of content pane view displays using contextual filters.
Comment #20
Drupa1ish commentedThanks @nagiek for pointing me into the correct direction with #19.
Use case
My use case is to show a block with contextual filters on the product page. I have to do it with http://drupal.org/project/context, since Drupal Panels is not yet mature for drupal commerce http://drupal.org/sandbox/manarth/1349452
For Panels, the issues is solved with http://drupal.org/node/1284738#comment-5726882, already commited at the latest devs.
#18 is good, but not good enough. See http://drupal.org/node/1269794#comment-4951030 : Thanks for the information.
Patch request regarding #1284738: Wrong form action URL for exposed filters of content pane view displays using contextual filters
There are still issues for block with contextual filters included with drupal context
My 2 cents
http://drupal.org/files/views-exposed-filter-url-1284738-21.patch takes a step to generalization calling $form['#action'] = url($view->display_handler->get_url());, instead of $form['#action'] = url($view->get_url());
Now, it’s up to other plugins to extend views_plugin_display. For drupal panels, we have
http://drupal.org/files/ctools-views_content-get_url-1284738-21.patch.
Conclusion: A patch for views_plugin_display_block.inc would be required, or another views_plugin_display
My ugly workaround
From the code http://drupal.org/node/1284738#comment-5017504, I added hard coded an or condition ($this->current_display== "my_block_name")
Comment #21
tanvirahmad commentedhttp://drupal.org/node/1359594#comment-5944750 Worked for me
THANKS :))))
Comment #22
raphael apard commentedI enabled " Skip default argument for view URL and it's working for me.
Comment #23
bojanz commentedIf you set override_url instead of override_path, no appending will happen inside Views.
This is what VBO 7.x-3.0 does.
The latest -dev doesn't even call get_url() anymore, for more clarity. So this shouldn't be an issue anymore.