Hi!

Is it possible to trigger the child window to close and open a new modal frame when clicking a jquery selector?

Want to use the module as a navigation menu, but could not achieve this.

Thanks,

Smudio

CommentFileSizeAuthor
#2 Bildschirmfoto 2010-08-06 um 15.52.39.png273.62 KBSmudio

Comments

markus_petrux’s picture

Category: feature » support
Status: Active » Fixed

Re: "Is it possible to trigger the child window to close and open a new modal frame when clicking a jquery selector?"

Yes, you can close the modal frame from javascript in the child window like this:

Drupal.modalFrameChild.triggerParentEvent('childClose', [args, statusMessages]);

You can use the args argument to pass an arbitrary indicator for your implementation of the onSubmit callback of the parent modal frame to do what you need. And there you can, for example, do something like:

  // This code goes inside the onSubmit callback of the parent modal frame.
  // While the modal frame will be automatically closed, we can create a delay
  // to open a second modal frame.
  setTimeout(function() {
    Drupal.modalFrame.open(options);
  }, 100);

----

Alternative that could be easier: When processing the event of your jQuery selector on the child window, when you need to load a different page on a modal frame and close the current one, you can simply reload the current one with a different URL:

  window.location = url;
Smudio’s picture

Status: Fixed » Active
StatusFileSize
new273.62 KB

Thanks so much, but I think I did not explain properly, what I'm trying to achieve.

There is a menu in the parent window. Every menu item opens in a modal frame. Is it possible to click another
menu item in the parent window once a child modal frame is loaded and thereby (click) open the other modal frame instead of the active one??

Hope this is clear enough...

attached is a screenshot: would it be possible to open "KUNDEN" now with its child modal frame, replacing the active one?

markus_petrux’s picture

Modal implies the parent window is not reachable. This is a feature that is heavily tied to the way the Modal Frame is coded, because part of the job it does is related to control the focus.

I would suggest to write a menu inside the modal frame. See the "Search and reference" and "Create and reference" features of the Node Relationships module. Both options are implemented as tabs that are part of the child window in the modal frame.

Another possible alternative to your use case would be to use the jQuery UI Dialog plugin directly.

markus_petrux’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.