Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Jun 2011 at 15:55 UTC
Updated:
23 May 2014 at 16:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedThis works for exposed filters, but fails to include arguments for some reason.
Referencing the VBO issue: #1191748: AJAX exposed filters break VBO out of the overlay.
Comment #2
dafederHere's one that fixes the argument problem, I believe.
Comment #3
bojanz commentedThat works nicely, thanks!
Comment #4
slashrsm commentedDoes not work with my view that uses VBO. When I submit VBO action it just redirects to frontpage.
Comment #5
bojanz commentedYou're using VBO in a block, right? That use case probably requires more work.
Comment #6
slashrsm commentedYes, that's true....
Comment #7
bojanz commentedI'm not sure there's much Views can do in that case. The form probably needs to point to a page display.
Let's see what dereine thinks.
Comment #8
Letharion commentedAssigning to dereine by request from bojanz.
Comment #9
bojanz commented@dereine
You asked me on IRC to check whether just $form['#action'] = url($view->get_url()); would work. It doesn't.
In general, I think we can commit the attached patch.
The other question is whether VBO (or any views form) can be made to work from a block. To be honest, I don't care that much.
Comment #10
dawehnerPatch looks fine and said before. Commited to both branches.
Comment #11
rszrama commentedThis commit broke the shopping cart form in Commerce, because the View is actually embedded at the /cart URL by the Cart module. Accordingly, it doesn't have a URL of its own and just submits the form to /. : P
It would probably be wise to check to see if $view->get_url() actually returns anything before setting this form to submit there.
Comment #12
bojanz commentedUgh. We definitely need to figure out how to handle blocks /embedding then. For the meantime, I have committed a fix like this one to VBO.
So, let's reverse the patch for now.
Comment #13
rszrama commentedDamien mentioned the possibility of allowing us to specify a URL override when we embed a View. If that worked, then this would work just fine. Might get his opinion one way or the other before reverting - Commerce has tried to keep pace with RC1, so recommending that in the short term doesn't hurt anyone.
Comment #14
merlinofchaos commented$view->override_path will always work -- if you're embedding then you have the ability to do this.
Comment #15
rszrama commentedHmm, in my embed function, I tested this by setting
$view->override_path = 'cart';, but examining the form action shows "/cart/2". For some reason the order ID is getting appended to the path even though no such path is defined by commerce_cart.module.Comment #16
merlinofchaos commentedRight, views assumes that the arguments need to be part of the path. If you're passing the arguments through, there's no really easy way to have it NOT put the arguments in the path right now. :/
Comment #17
merlinofchaos commentedIf you've got default argument (er, contextual filter) there's a checkbox that will prevent adding that to the path, though.
Comment #18
rszrama commentedOk, that's a good lead. We are using a contextual filter for the form, and I did check the "Skip default argument for view URL" box, but it's still showing in the form action (i.e.
$view->get_url()). I can check two things on my end - it could be our argument handler is screwing that up somehow, or perhaps since I'm setting the "contextual filters" via$view->set_arguments($arguments);it's functioning different than if it came through the URL. Not sure how stupid those ideas sound, but I'll start there when I get a sec to pursue this further. : )EDIT: Maybe I'll save myself some time. On save, I saw that this would only affect a default argument, which I'm not sure we're specifying any. Will check there before bothering with those other ideas. : P
Comment #19
damien tournoud commentedOne way of properly supporting embedded views would be to add a
->override_urlproperty that completely skips the argument logic inside->get_url().views_embed_view()could set this property to$_GETmanually.An alternative would be to only set
#actionif->get_url()has returned a valid path, so that displays that do no support paths stay unaffected.Comment #20
dawehnerreverted the patch.
Comment #21
andypostPanels works fine with path override for exposed filters by filling a "Override URL" maybe batter to take a look at working implementation
Comment #22
geerlingguy commentedSubscribe. Just hit this issue when trying to embed a block with an exposed form/Ajax on one page on my site. Users are redirected to / if they hit enter, or to the path of any prior page-type display in the view providing the block display I'm using.
[Edit: To others having this problem when embedding blocks: if you just create a page display *exactly* the same as the block display, and set the path of the page display to the path where the block is being displayed, the view should work correctly (and won't overtake your module-defined (hook_menu()) page).]
Comment #23
caelon commentedSubscribe. Use case:
- Using VBO for the admin/content/node view
- Added an additional field to display the "project number" of the content (just a node field)
- Search by that project number
- Click the edit button
- The URL comes up: http://www.website.com/node/202/edit?destination=views/ajax
- Obviously the ?destination=views/ajax is the problem
Comment #24
bojanz commentedThis makes sense to me.
Comment #25
bojanz commentedCompletely untested.
Comment #26
dawehnerThis would kill the path from views with arguments. If the user want's to override the url, he should use the view object and preview.
Comment #27
bojanz commentedMakes sense, I guess.
Comment #28
dawehnerDoes someone uses this patch on real world?
I'm just wondering as this might be possible to break a lot of things.
Not that i think that it does, just general interest.
Comment #29
geerlingguy commentedI still need to test. Right now the problem only exists on some admin views I'm using, as I don't have AJAXy goodness on any user-facing forms. I will try to test when I get a chance.
Comment #30
dawehner@bojanz
Please post when it's time to commit the patch.
Comment #31
dawehnerAnd commited.
Comment #32
bojanz commentedOkay, so DamZ, dereine and me agreed we want to consider doing this as well.
This makes views forms work by default when embed, and through forms. Couldn't think of any reason why this shouldn't be committed, but maybe Earl can think of something.
Comment #33
dawehnerLet's do this in a new issue as this has absolute nothing to do with views form and ajax anymore.
Comment #34
andypostPlease link new issue here
Comment #35
hansfn commentedYes, a link to the new issue would help. I tried to find it by searching the issue queue, but I failed. (I'm using Views 7.x-3.3 and the block usage issue seems to be unresolved.)
Update: I just noticed that VBO is working around the block usage issue.
Comment #36
bojanz commentedLatest VBO has no workarounds and doesn't need them (at least for the thing that Views got a fix for)
Comment #37
hansfn commentedHi, bojanz. Thx for commenting.
VBO still contains the "Allow VBO to work when embedded using views_embed_view(), or in a block." code (in views_bulk_operations_form_alter). You might not consider that a work-around, but the fact that I had to repeat that code in Views Send makes me think that this should have been a part of Views.
Comment #38
bojanz commentedAh right, sorry, I thought I removed that.
You can see why that isn't acceptable in #33, it was just a change that was too invasive.
Comment #39
bloomt commentedI cant seem to get this patch to apply. did the issue of the views/ajax problem get fixed or moved to another issue?
Comment #40
Jooblay.net commentedWe are having this same issue or issues with ajax and the add to cart button on our production server but not on our Dev Ubuntu server. Ajax and Add to cart button works fine on our local dev servers. We can not create the Add to cart or Ajax error on our Ubuntu 12.04 lts
The dev server is the following:
Ubuntu 12.04
Apache/2.2.22 (Ubuntu)
PHP 5.3.10-1ubuntu3.5
Drupal 7.20
Php.ini memory_limit 512
Production server:
CentOS 5.6
Php 5.2.17
Apache/2.2.22
Drupal 7.20
Php.ini memory_limit 512
Any thoughts the ajax and add to cart maybe separate issues as well. Could this issue be caused from Php 5.2?
Further research on the ajax and add to cart breaking seems to have something to do with compressing files under Performance? more later on this...
Comment #41
bloomt commentedDid anyone ever find the solution to this problem?