Using Prototype/Scriptaculous in a popup window

216 views
Skip to first unread message

Bobby.D

unread,
Sep 20, 2008, 12:46:51 PM9/20/08
to Prototype & script.aculo.us
I'm using the following function to generate a pop up box:

var win=null;
function popUp(page, name, w, h, scrollb) {
var winL = (screen.width-w)/2;
var winT = (screen.height-h)/3.5;
var settings = 'height='+h+',';
settings += 'width='+w+',';
settings += 'top='+winT+',';
settings += 'left='+winL+',';
settings += 'resizable=no';
settings += 'scrollbars='+scrollb+',';
settings += 'toolbar=no';
settings += 'menubar=no';
window.open(page, name, settings);
}

I use the following link to open:

<a href="#" onclick="popUp('initiate.php', 'Initiate Case', '600',
'600', 'no')"><img src="images/initiateCase.png" alt="Initiate Case" /
></a>

The popup works, however, I can't get ANY AJAX to work on the pop up.
I'm successfully loading several Spry Assets, I can't figure out why I
can' get any of the AJAX to work.

I'm using an Updater to display a dynamically generated number from a
PHP page. When I pull the php page up, it is working properly....but
no update.

Could it be because of the way I'm opening the page?

bluezehn

unread,
Sep 20, 2008, 1:49:27 PM9/20/08
to Prototype & script.aculo.us
Can I please, please beg of you not to use a popup window. It's ugly.
Most browsers just block them anyway so it's useless.

You've got to remember as well that a popup window is a COMPLETELY
separate browser instance. You can't access any variables at all from
the source window, and prototype/scriptaculous will not be available
unless they're included in the source of the popup.

Much much better is to bring up a fixed positioned div floated above
everything else on the page. Google prototip to see what I mean - and
they don't have to be "tooltips" either, they can be full on windows
over the rest of your page - see the other project by the author of
prototip, think it's called lightbox, to see what I mean.

Other than that advice, your question is way too vague to be able to
answer it. If you have prototype in the source of the popup window,
ajax will be available just as it otherwise would be - either you
haven't included prototype or there's an error in your code, in which
case the fact that it's running in a popup window is completely
irrelevant.

Bobby.D

unread,
Sep 20, 2008, 2:09:14 PM9/20/08
to Prototype & script.aculo.us
Ok, I was just checking about the popup, I thought perhaps using the
function to open would screw stuff up. I am designing an Intranet
Business Web App, restricted to 1 browser. If I was going to use a
"lightbox" effect I'd just open a whole new page, but I'm trying to
give the app a slightly more desktop feel.

jason maina

unread,
Sep 20, 2008, 2:52:28 PM9/20/08
to prototype-s...@googlegroups.com
In the parent page/window you could have an invisible div then use
ajax.request to update the div with desired data and seem to popup by
setting visibility=true

--
Sent from Gmail for mobile | mobile.google.com

Bobby.D

unread,
Sep 29, 2008, 4:39:50 PM9/29/08
to Prototype & script.aculo.us
Maybe eventually I'll move to that. I'm all for using your idea, but
this is stage 1 of a several stage development program for this
company.

For those wondering, we moved all of our Prototype/Script.aculo.us
files from "support" into a "js" folder....and then didn't update part
of the source code....

On Sep 20, 2:52 pm, "jason maina" <jason.ma...@gmail.com> wrote:
> In the parent page/window you could have an invisible div then use
> ajax.request to update the div with desired data and seem to popup by
> setting visibility=true
>
Reply all
Reply to author
Forward
0 new messages