[Seaside] popup window

Julian Fitzell julian at beta4.com
Wed Feb 18 04:46:49 CET 2004



Julian Fitzell wrote:
> Nevin Pratt wrote:
> 
>> Anybody know of a way to do this?:
>>
>> I have a Seaside component, which renders a button (among other 
>> things).  The button is hooked to an action method of the component, 
>> such that when the button is pressed, the method executes.  (in other 
>> words, the component is doing just normal Seaside stuff here)
>>
>> But, I would like a small popup window to pop up for the user, either 
>> before the action method executes, or at the beginning of executing 
>> the action method.  Then when the action method finishes executing, I 
>> would like the popup window to go away.
>>
>> Basically, the popup window would be a "Please wait..." message that 
>> would be displayed to the user during execution of any action method 
>> that needs the user to be a little more patient (i.e., action methods 
>> that take a long time to execute, like 15 or 20 seconds or even 
>> longer).  Then, when the action method finishes, the "Please wait..." 
>> message automatically goes away.
>>
>> Anybody know how to do that?
> 
> 
> Well you'll need to use javascript to accomplish that obviously.  You'd 
> probably want to attach a script to the submit button's onclick handler 
> to open the window and then another to the onload handler of the <body> 
> tag of the completed page so that it got executed once the results were 
> done loading.
> 
> As I recall, when you open a window you can give it an identifier (same 
> as the target= attribute on an href) and you can then use that to find 
> the window to close in the second script.  It's been quite a while since 
> I did anything like this though so the details are a little fuzzy.
> 
> You could try http://www.w3schools.com/js/default.asp for some info, 
> although scanning it quickly doesn't reveal all the necessary tricks to 
> me.  Still, w3schools have good CSS and DHTML tutorials so it might be a 
> useful JS primer if you're not too familiar with it.  Hopefully a google 
> search will turn up the remaining details for you...  I may also have it 
> in a cookbook at work; I'll post again when I get in if I do.

Actually, it appears not to be that simple.  There may not be any (any 
reliable, anyway) way to get at the window from a different page than 
the one that opened it.  Apparently you need to use some trickery 
involving framesets so you can stash a reference to the window in 
another frame and have the new page that loads get it out of there.  And 
actually, it's probably worse than that because to be sure the user's 
security permissions allow you to close the window, you probably need to 
actually get the other frame to do the opening and closing (some 
browsers won't let a page close the window it didn't open).

I'm not sure there's any non-hacky solution to this...

Julian


More information about the Seaside mailing list