How to call a javascript in parent page from a Prototype Window?

0 views
Skip to first unread message

syg6

unread,
Sep 27, 2007, 6:48:55 AM9/27/07
to Ruby on Rails: Spinoffs
Hello all.

(If some of you are seeing this twice I apologize. After posting using
Nabble I got an email saying I would have to join the group to post,
so I joined and re-sent.)

I've been messing around with this all morning. I've looked at all the
examples ... there doesn't seem to be a mailing list for the Prototype
Window Class but people seem to know a lot about it on this list so
I'll try my luck.

I open a Prototype Window and display a list. When the user clicks on
one of the elements in the list I would like to call a js function I
have defined in the page that opened the Window. How do I do this?

I've tried 'old school' parent, parent.opener ... I've also tried
using observers but they don't seem to be triggering.

Can someone throw me a clue?

Thanks,
Bob

syg6

unread,
Sep 27, 2007, 7:43:56 AM9/27/07
to Ruby on Rails: Spinoffs
Figured it out myself. There were a few things were messing me up.

1. I had defined an 'onDestroy' observer, when I needed an 'onClose'
observer.

2. I am using jQuery with Prototype. Since the js function I was
calling in the parent page was failing I figured it was Prototype's
fault. It wasn't. Instead of using '$' as I have until now for my
jQuery stuff I have to use 'jQuery'. (eg. instead of '$
("span#street").html(text);' use 'jQuery("span#street").html(text);')

3. So as it turns out, when you define an observer and stick js stuff
in it, like function calls, these functions are in the PARENT page
where you define the window (just as I wanted) not in the window that
is created.

3. From WITHIN the created window if you call 'top' you have access to
the parent page, just like in the old days.

That's all. Hope my 'Prototype Window Class for Idiots' guide helps
someone ...

BOb

syg6

unread,
Sep 29, 2007, 5:16:12 AM9/29/07
to rubyonrail...@googlegroups.com

I've been messing around with this all morning. I've looked at all the
examples ... there doesn't seem to be a mailing list for the Prototype
Window Class but people seem to know a lot about it on this list so I'll try
my luck.

I open a Prototype Window and display a list. When the user clicks on one of
the elements in the list I would like to call a js function I have defined
in the page that opened the Window. How do I do this?

I've tried 'old school' parent, parent.opener ... I've also tried using
observers but they don't seem to be triggering.

Can someone throw me a clue?

Thanks,
Bob
--
View this message in context: http://www.nabble.com/How-to-call-a-javascript-in-parent-page-from-a-Prototype-Window--tf4527604.html#a12918725
Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com.

Tobie Langel

unread,
Sep 29, 2007, 6:13:27 AM9/29/07
to Ruby on Rails: Spinoffs
Hi,

there actually is a forum (http://pwc-forum.xilinus.com/) and a
mailing list (http://fates.multisite.site5.com/mailman/listinfo/
javawin_xilinus.com) for PWC.

Hope this helps.

Regards,

Tobie

On Sep 29, 11:16 am, syg6 <s...@yahoo.com> wrote:
> I've been messing around with this all morning. I've looked at all the
> examples ... there doesn't seem to be a mailing list for the Prototype
> Window Class but people seem to know a lot about it on this list so I'll try
> my luck.
>
> I open a Prototype Window and display a list. When the user clicks on one of
> the elements in the list I would like to call a js function I have defined
> in the page that opened the Window. How do I do this?
>
> I've tried 'old school' parent, parent.opener ... I've also tried using
> observers but they don't seem to be triggering.
>
> Can someone throw me a clue?
>
> Thanks,
> Bob
> --

> View this message in context:http://www.nabble.com/How-to-call-a-javascript-in-parent-page-from-a-...

Reply all
Reply to author
Forward
0 new messages