![]() |
![]() |
|
|
||
Find out how to display a "Working..." popup window to let visitors know a form submission is being processed. The popup closes automatically as soon as the "thank you" page is finished loading. This is what happens:
The popup can contain, "Working..." or other explanatory text. It can contain an image, maybe an animated GIF with a progress bar, or even a flash animation. (A demonstration, with a link for downloading a working example, is at http://willmaster.com/a/12/pl.pl?art125) The rest of this article explains how it works. One web page needs to be created (the popup page) and two web pages need to be modified (the form page and the thankyou page). The Popup Page First, create the popup page. The example contains the text, "Working..." You can put any content you want into the popup page. <html> <body onLoad="self.focus();" onBlur="self.focus();"> <h1>W o r k i n g . . .</h1> </body> </html> Notice that the popup page's <body... tag contains the attributes onLoad="self.focus();" onBlur="self.focus();" The onLoad=... puts the popup on top when it finishes loading. And the onBlur=... puts the popup back on top whenever a different window is clicked. That's all that needs to be done with the popup page (except uploading it to your server, of course). The Form Page Two changes need to be made to the web page with the form:
You're done with the form page. The ThankYou Page The thankyou page also needs two changes:
And that's all for the thankyou page. How It Works The key is in the naming of the popup window. It happens in this line: WorkingMessagePopup=window.open(url,"wmp",att); The above line creates a popup window and names it "WorkingMessagePopup" The same name is used in both the form page and the thankyou page. The form page creates the popup with the content at the specified url. The thankyou page creates the same popup but with no content and then immediately closes it. (The reason the thankyou page loads the popup before closing it is because some browsers don't recognize the popup's name unless it has been created by the page that does the closing.) So when your form's submit button is clicked, the popup appears. Your CGI script then does whatever it's supposed to do. When the script is done and redirects the visitor's browser to the thankyou page, the thankyou page loads and then closes the popup. A demonstration page containing a link for downloading a ZIP file with the complete demonstration set is at http://willmaster.com/a/12/pl.pl?art125 By: Will Bontrager Copyright 2001 Bontrager Connection, LLC
| ||