Google Groups Home
Help | Sign in
Custom event from subwindow handled in opening window - possible?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
SWilk  
View profile
 More options Jul 4, 10:41 am
From: SWilk <wilkola...@gmail.com>
Date: Fri, 04 Jul 2008 16:41:01 +0200
Local: Fri, Jul 4 2008 10:41 am
Subject: Custom event from subwindow handled in opening window - possible?
Hi,

I got stuck by some window to window communication issue.

I have a main window witch open a popup window with window#open
method. The popup contains a small form.

In onsubmit handler ot that form I generate a custom event, say
'vera:euChosen', with a complicated memo.

I fire it with
  Element.fire(window.opener.document, 'vera:euChosen', memo);

I also do
  document.observe('vera:euChosen',refToMyHandler);

in parent window. Now I get a result I do not understand.

When the event is fired, the refToMyHandler(evnt) is executed, but
the evnt is of type 'dataavailable' and there is no trace of my memo.

Am I doing something wrong, or one just can't pass a custom event
between two windows (even if the firing window is opened by the
listening window)?

I tried also to fire the event on a popup window and listen on it.
I tried both window.document documents and I always get dataavailable
and not my custom event.

How can I transwer my memo object to my main window (window.opener)
without knowledge of any js function or element of main window in my
popup window? I need to use this popup in several pages, and would
like just to pass my data, to any main window. Main window's scripts
should decide what to do with them.

Any suggestions?

Regards,
Szymon Wilkołazki


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kangax  
View profile
 More options Jul 4, 12:16 pm
From: kangax <kan...@gmail.com>
Date: Fri, 4 Jul 2008 09:16:36 -0700 (PDT)
Local: Fri, Jul 4 2008 12:16 pm
Subject: Re: Custom event from subwindow handled in opening window - possible?
Szymon,

All custom events are piggybacked on "dataavailable" and are injected
with "memo" property on an event object itself. As far cross-window
messaging, I don't think this is possible with current implementation.
Custom events simply bubble up to a top level element in the scope of
the window that originated event.

-- kangax

On Jul 4, 10:41 am, SWilk <wilkola...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SWilk  
View profile
 More options Jul 7, 6:47 am
From: SWilk <wilkola...@gmail.com>
Date: Mon, 07 Jul 2008 12:47:23 +0200
Local: Mon, Jul 7 2008 6:47 am
Subject: Re: [Rails-spinoffs] Re: Custom event from subwindow handled in opening window - possible?
Hi,

kangax wrote:

  > All custom events are piggybacked on "dataavailable" and are injected

> with "memo" property on an event object itself. As far cross-window
> messaging, I don't think this is possible with current implementation.
> Custom events simply bubble up to a top level element in the scope of
> the window that originated event.

Thanks for your reply.
I tested it a bit more and it turns out, that I can get the
dataavailable event *with* the memo *if* I open popup window with
incorrect html, without all the <html><head><body> tags, just the html
content. It's a little weird for me.

Anyway I do not want to do that, so I decided to use ajax instead
popup, even if it means breaking our app "standards" (this is a very
old web app, lots of things are done in popups). Of course there is no
problem with custom events fired from ajax loaded content. My problem
disappeared :)

Thanks again,
Szymon Wilkołazki


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google