Closed (works as designed)
Project:
Lightbox2
Version:
6.x-1.9
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Mar 2009 at 08:27 UTC
Updated:
3 Feb 2012 at 14:30 UTC
I'm messing around with lightbox2 but can't get the functionallity i'm after:
I want a lightbox (lightframe/lightmodal) to open with an invite node, which i customized to look like "/invite?path=user/x". After submitting the node, using that link, i would like the lightbox to close.
I tried lightmodal, but after the node loads it instantly closes and redirects to the front page.
I tried lightframe, but after submitting the node it stays open and shows the front page.
Is there a way to set a lightframe to close after submitting a form? i understand that's what lightmodal is for, but i can't get it to display the node correctly.
Any ideas?
Comments
Comment #1
stella commentedThere's no way to get lightframe to close after submitting a form. You should use lightmodal to do this. However, when doing this you need to ensure that you're not loading the full html page in the lightmodal - just load the div / form / html snippet that you're interested in.
For redirecting to front page - you can tell Drupal forms where to redirect after the form is submitted. If it's not one of your module's forms, then use hook_form_alter() to change the redirection setting.
Cheers,
Stella
Comment #2
asak commentedI understand the correct way to go is to use the Lightmodal.
Problem is i can't figure out how to load this Tell A Friend node, which in it's "View" state (as opposed to edit) has a form in it for users to submit, without loading the full page. I get even more lost when trying to figure out how to add the "?path=..." correctly this way.
But i guess this is more of a Tell A Friend.module issue...
Thanks Stella!
Comment #3
stella commentedmaybe check out drupal_get_form() - see api docs on http://api.drupal.org
Cheers,
Stella
Comment #4
rc2020 commentedIt's actually fairly easy to perform this as I discovered. The issue is getting the JS of the CCK fields to work. If you poked around the issue queue, you'll see that lightbox can open a CSS ID (and class too, I think). Kinda like this:
This will open up the node form, and everything submits just fine. The problem at the moment that I am having is that there doesen't seem to be support for javascript in the modal. Fieldsets wont collapse/expand, cck date picker widgets don't work, and autocompletes also do not work - but everything else works just fine.
@Stella, is there a way to get around this? I mean honestly I spent the last 6 months trying to figure out how to get forms into a modal box, and now that this method is so unbelievably simple to do I'd hate to have it fall flat on its face because theres no JS support in lightmodal. Am I doing something wrong? This could have potential to be really cool!
Thanks!
Comment #5
philbar commentedI'm having this issue as well trying to get Inline Ajax Search to open in a LightModal.
Comment #6
kaldimar commentedI've found a quick and dirty solution to close the lightframe after form is submitted. It's not optimal but it fits my needs, as the visitor does not see anything but the lightbox being closed after the form is processed.
Webform 2.9 has a setting "Confirmation message or redirect URL", where I drop the absolute path to an html file containing this line:
<script type="text/javascript">window.parent.Lightbox.end();</script>Which fires the closing event of the lightbox containing the iframe. I hope somebody in a hurry can find this solution useful, but feel free to improve it and post.
Comment #7
capellicI realize this is a closed issue, but wanted to point out that trying this in Drupal 7 results in a en empty modal.