Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When defining a page view in the administration area using exposed forms, the overlay closes each time you submit the form.
Either views should care about the overlay or the overlay should take over the exposed forms properly.
Comment | File | Size | Author |
---|---|---|---|
#56 | 1116326-overlay-method-get-forms-56-D7.patch | 850 bytes | David_Rothstein |
#53 | 1116326-overlay-method-get-forms-53-D7.patch | 821 bytes | pwolanin |
#31 | vdc-d7-1116326-31.patch | 2.37 KB | s_leu |
#28 | Screen Shot 2013-06-17 at 01.11.31.png | 198.51 KB | yannickoo |
#26 | vdc-1116326-26.patch | 668 bytes | yannickoo |
Comments
Comment #1
miro_dietikerI also tried to implement hook_admin_paths
http://api.drupal.org/api/function/hook_admin_paths/7
And i tried to set the views path override in a views_preprocess function:
$vars['views']->override_path = $GET['q'];
But it seems there's more magic needed.
Comment #2
dawehnerviews_preprocess is probably too late to override the path. You would have to use something like hook_views_pre_render.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedI just played with this a bit, and the admin path stuff is a red herring. Any view at admin/* is already automatically admin path. My gut feeling is that overlay has a bug.
Comment #4
ksenzeeA method=get form can't work inside the overlay unless overlay takes over its submit event. Otherwise the browser will go straight to the non-overlay version of the URL. I'm attaching a patch that intercepts the submit event of method=get forms inside the overlay and redirects them to an overlay-friendly version of the URL they're trying to submit to.
Comment #5
miro_dietikerI see...
However this is a bug of the overlay module, right? So it should really be backported to D7...
Will we need (views? custom?) to add a JS to fix this issue in the meantime?
Comment #6
ksenzeeCertainly it's a backport candidate after it gets committed to D8.
Comment #7
miro_dietikerIn my D7 case the submitted patch works cleanly.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedForms submitted with a GET method are basically links. As a consequence, we should use the same logic for them as
Drupal.overlay.eventhandlerOverrideLink
. The code there will probably have to be refactored to allow that.Comment #9
Gábor HojtsyThis basically is a big UI problem for all exposed filters in "admin" views (when using the overlay), so I've tested the existing patch as well. Works like a charm. I did not look into optimization, code refactoring possibilities as outlined by Damien though, just saying the existing patch works well.
Comment #10
nod_tag
Comment #11
broeker CreditAttribution: broeker commentedPatch in #4 works great, except that it breaks the Reset button if applied to an exposed filter. The filter itself is working fine, but a Reset click does not actually reset the exposed filters. When I revert the patch, the reset functionality works again.
Comment #12
celstonvml CreditAttribution: celstonvml commentedPatch from #4 appears to work for me against core-7.14 and views-7.x-3.3
Comment #13
checker CreditAttribution: checker commentedI can confirm that #4 works except the reset button how it is described in #11.
Comment #14
hass CreditAttribution: hass commentedComment #15
hass CreditAttribution: hass commentedMarked #1630692: Exposed filter kills Overlay on My Drafts tab as duplicate.
Comment #16
hass CreditAttribution: hass commentedMarked #1399894: Submitting an exposed filter in overlay, closes the overlay as a duplicate.
Comment #17
hass CreditAttribution: hass commentedDuplicate #1788888: Overlay at admin/modules closes on submitting the form.?
Comment #18
Christian DeLoach CreditAttribution: Christian DeLoach commentedThe reason the "Reset" button does not work is because the patch from #4 prevents the form from submitting. Instead, the update serializes the form fields and redirects the browser to the path of the form action (the path of your view) with serialized form field data as arguments in the URL. Serializing a form does not include submit button arguments so the name/value of the submit button clicked or the name/value of the form's default submit button is not passed as arguments in the serialized form data. The default submit button for the exposed filter form does not have a name so not passing the name/value via the serialized form data is not a problem if only the default submit button is used. However, the reset button does have a name and value which are needed by views to reset the form.
The patch from #4 is not the right solution. We should find a solution that allows the form to submit.
There are a couple issues we have to deal with. The argument render=overlay is automatically appended to the form's action by Drupal.overlayChild.behaviors.parseForms() in modules/overlay/overlay-child.js which helps to retain the overlay when the form is submitted. However, since the form's method is "get" any arguments passed view the form's action are overwritten by the form's fields so render=overlay is not passed as an argument like it would if the form's method were "post". One option may be to update parseForms() to append a hidden form field named "render" with the value "overlay" to the start or end of the exposed filter <form> instead of updating the form's action. I've tested this option and it addresses the issue. It's a bit of a hack but unless exposed forms can be submitted using "post" method, I'm not sure of a better solution.
Please provide input.
Comment #19
xjmComment #20
mariagwyn CreditAttribution: mariagwyn commentedIn attempting to validate this per officehours task (http://core.drupalofficehours.org/task/2046), we confirmed that the patch above (overlay-modules-form-submit-1788888-14.patch) DOES NOT fix admin views with exposed filters in overlay (http://drupal.org/node/1116326)
Assisted by: pixlkat
Steps Taken:
Comment #21
Gábor HojtsyNote that this is becoming a much bigger problem with admin/content being a view with exposed filters. Not sure about elevating to major but thought about it :)
Comment #22
s_leu CreditAttribution: s_leu commentedI guess the solution suggested by AHOY in #18 is a bit hacky but it's working also for the reset button and i think a hidden element rendered only in overlays doesn't break anything. So here's a patch that solved that issue for D8.
If this will be commited i will of course provide a patch for views in D7 as well.
Comment #23
dawehnerWe should use the request object instead of $_GET
Comment #24
s_leu CreditAttribution: s_leu commentedChanged that the condition checks to use $_REQUEST
Comment #25
dawehnerThis is what a actually meant.
Comment #26
yannickooAdded a comma after
#value => 'overlay'
and trimmed the comments.Comment #27
dawehnerThank you. I would RTBC it, if I have a clue about the overlay.
Comment #28
yannickooOh, it seems like there is no
?render=overlay
anymore? :/Comment #29
s_leu CreditAttribution: s_leu commentedDawehner's solution doesn't proposed in #25 doesn't work. The return value of the request object for the get parameter "render" is empty. The solution of the patch in #22 still works well, needs a reroll though.
Anyway, no matter what solution that is just adding a hidden field, all this is just a workaround, and other forms in overlays will still drop out of the overlay once they are submitted. The actual bug lies in the overlay module itself.
However since i tested it already i will add the reroll for the solution of #22 again.
Comment #30
dawehnerWell, you should not use $_GET anymore in Drupal 8, just saying.
Comment #31
s_leu CreditAttribution: s_leu commented@dawehner well i'm not so experienced with the d8 API and so your first comment in #23 wasn't really helpful for me. Your comment in #30 is ok, but if you take the time to write that comment you could maybe also add an explanation on why it is like that or at least reference to some source. There are people out there that have only little or no experience with d8 API ;)
However, i found looked at the first patch in this issue again and since the only problem with it was the dropping out of the overlay on pressing the reset button, i tried to fix that. Here's what i came up with.
Comment #33
miro_dietikerThe second failure was "by intention"... .-) The first still needs review.
Comment #34
yannickooFound some coding standards related issues.
Why you are using '===' and later only '=='?
Why you are using double quotes?
We need spaces before and after the '=='.
A space after the comma would also be great.
Single quotes please.
Comment #35
realitylooprerolled with fixes requested as per #34
Comment #36
s_leu CreditAttribution: s_leu commentedLooks good to me
Comment #37
yannickooWorks fine, tested it with the file overview.
Comment #38
xjm#35: vdc-d8-1116326-35.patch queued for re-testing.
Comment #39
alexpottAssigning to nod_ for a js review
Comment #40
nod_This is a views issue, overlay provides a way of adding behaviors to the child frame without messing with overlay javascript.
This patch made me learn that views would add a hardcoded onclick attribute, not cool. I haven't seen it though so I don't know if it's actually required. Can you point out to me when that attribute would get added (so that I can get rid of it)?
Other than that I'm happy with it now.
Comment #41
nod_with the patch now…
Comment #42
nod_Comment #43
dawehnercore/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php
In the UI add a new view, add some fields and click on the dropbutton to select "rearrange".
Comment #44
HenSod CreditAttribution: HenSod commentedI have a similar problem that only occurs in Internet Explorer 10. I have added the patch https://drupal.org/node/1116326#comment-7679599 and when I submit a form in admin overlay using Internet Explorer 10 the host is set to admin.
Fiddler says:
Result: 502
Protocol: HTTP
Host: admin
URL: /admin/pegasus/dashboard/drafts?title=&type=All&state_1=draft&uid=&field_section_tid=All&render=overlay
Comment #45
hass CreditAttribution: hass commentedComment #46
dawehner@nod_
Which steps are required to get this patch RTBC?
Comment #47
nod_Overlay is dead to D8 #2088121: Remove Overlay.
Comment #48
damiankloip CreditAttribution: damiankloip commentedI think you meant to close this instead?
If not, sorry in advance! :)
Comment #49
Gábor HojtsyApplies to views in 7.x no?
Comment #50
damiankloip CreditAttribution: damiankloip commentedYes, sorry. I somehow didn't see this had been moved back to 7.x - thanks!
Comment #51
pwolanin CreditAttribution: pwolanin commentedLooks like this is back to being about a bug in Drupal 7 core now?
Comment #52
pwolanin CreditAttribution: pwolanin commentedSeems like this should go into overlay module itself as a form_alter or maybe Form API?
Comment #53
pwolanin CreditAttribution: pwolanin commentedHere's a generic overlay module patch - seems you need to use $_REQUEST instead of $_GET to detect this.
Checked using the maillog module's View with an exposed filter.
Comment #54
nod_Looks good to me.
Comment #55
David_Rothstein CreditAttribution: David_Rothstein commentedGiven that this is modifying a potentially large number of forms, I think it would be good to check that $form['render'] doesn't already exist in the form before writing it.
If it does ever exist, it's better for this bug to keep occurring on that particular form than to clobber whatever else is there.
Comment #56
David_Rothstein CreditAttribution: David_Rothstein commentedQuick reroll fixing that, as well as a few small code style issues.
Comment #57
Poieo CreditAttribution: Poieo commentedWorking great for me.
Comment #58
umberto. CreditAttribution: umberto. commented#56 work fine for us.
Comment #59
Elin Yordanov CreditAttribution: Elin Yordanov commentedI can also confirm that the patch works like a charm. Thanks! Please commit to next release.
Comment #60
Fabianx CreditAttribution: Fabianx as a volunteer commentedThis is good to go. Marked for commit!
Comment #61
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedCommitted to 7.x - thanks!