4

I'm trying to display all the node edit forms neatly within Lightbox, without any of the excess content I don't want: no sidebars, footer, header, nothing but just the content. So I created a page-node-edit.tpl.php file.

I have two problems daunting me, but for now I'll only mention the first since its more important.

From any page, clicking on the "edit" link for the node doesn't activate the Lightbox like it should; instead, it clicks through the link as normal.
With jQuery in the header I added a "del" attribute for the Lightbox to the links, but the box still doesn't activate. I tested the Lightbox on a link I hardcoded into the page, and it activated just fine. For elements generated by Drupal, like the node edit link/button the problem seems to be timing.

I think the "del" attribute needs to be built with the page, with the link, rather than appended onto it. The catch is, the link lacks an id and class, so I don't see how the hook_alter_link() function can help me.

I'm willing to try anything. Perhaps someone has opened a node/edit form within Lightbox before.

1

Seems like you just need to disable the default action for that link, i.e. force the link to return FALSE.

$("a").click(function() {
  $(this).lightbox;
  return false;
});

Obviously, you'll need to change the target from "a" to the specific edit link.

  • Thanks so much for trying to help me, MikeNGarret. I truly appreciate it. Unfortunately, when I implemented the your solution, the lightbox refused to activate. I think it requires that click-thru behavior to work. I've been investigating to find a way to get around this, but nothing yet. I'm not giving up, so please keep the continue to pass along any suggestions you may have if you have any free time to spare. Thank you. – SFox May 1 '11 at 1:43
  • I did some research and I think I steered you the wrong direction. Lightbox isn't really meant to support this type of interaction. I'd use shadowbox, thickbox, or colorbox instead. Or you can do what @Dipen suggests below. – MikeNGarrett May 4 '11 at 14:29
2

If installing one or 2 additional module is an option then you can check Popups API (Ajax Dialogs). When I last checked, the module had functionality of opening forms in popups, which you can theme. I also feel that, in the way Drupal form API works, there is more to done then just adding classes and JavaScript to make Drupal forms work in Lightbox.

1

If you have Theme developer enabled, Lightbox will not work.
Theme developer should not be kept enabled, but enabled when necessary to get the necessary information; once you don't need it, you should disable it.

Some versions of the Devel module, had a link to enable or disable that module; I didn't check the latest version of Devel, and the link could not be present anymore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.