Trouble with Status/Progress Window |
azstyx 02-03-2005, 09:21 PM Environment:
CPAN Perl 5.8.4
Solaris 8
use CGI.pm;
JS 1.2
Problem (was posted on Perl forum with no luck):
Need to do the following:
User enters info on form, clicks on submit, a status window opens with warning messages (Javascript displaying neon characters) that a process update is running and not to close window. Then the process finishes, user gets ok message (in same window as where the neon message was displaying)and closes status window.
What I am trying to do is to warn the user a process is running and they must not close the window prematurely, otherwise the process will abort. I am not sure if I am taking the right or smoothest approach to this problem.
Any suggestions on method or how to correct my issue?
I have three modules:
1) auxupd.cgi - (Perl)Creates the HTML for a form with 3 input fields and a submit button.
2) auxupdater.htm - HTML doc that has JavaScript that displays a neon message warning the user not to close the window until the update process has completed. It uses some standard shareware code for printing neon characters.
(Here's what my messages are and this doc (auxupdater.htm has been tested standalone ok):
One moment please, the information is being updated...
Please be patient ...
Wait for Update Completion Message.
DO NOT CLOSE THIS WINDOW!
3) auxupdater.cgi - a Perl module that takes the parms from the form created by auxupd.cgi and updates the appropiate flat csv files. When it finished the update, it should overwrite the window with the neon message with a successful completion message such as "OK, I have updated your info!!!".
The process flow:
1)auxupd.cgi (Perl module) creates small window with 3 fields and submit button. This CGI action (auxupd.cgi)is invoked from another page as:
<a href=http://www.codingforums.com/archive/index.php/"JavaScript:;" onClick="MM_openBrWindow('../cgi-bin/auxupd.cgi','','width=500,height=350')">
Cool! no problem here.
The Submit button should do the following actions:
a) open a new small window (350px x 300px; using auxupdater.htm)which displays the JavaScript neon message, warning the user not to close the window until the process has completed.
b) while the neon message is running, auxupd.cgi must kick off the Perl module that will do the file updates (auxupdater.cgi).
The FORM parms are (Action=auxupdater.cgi, onSubmit= open.window(auxupdater.htm):
Here's the corresponding Perl code:
print $cgi->startform(-method=>'GET', -action=>'auxupdater.cgi',
-onSubmit=>'window.open("/auxupdater.htm",
"", toolbar=no, location=no, directories=no,
status=no, menubar=no, scrollbars=no, resizable=no, width=350, height=300)'
);
The issue:
My HTML doc with the neon message (auxupdater.htm) is not getting displayed, the process jumps to auxupdater.cgi
immediately and I get the message "OK, I have updated your info!!!" as the next screen. Furthermore, this dislayed text is overwriting the window with the three fields and the submit button. It appears that the open.wondow(auxupdater.htm) never fires.
Any suggestions on how to correct this or re-architect this???
Thanks Team!!!!
Willy Duitt 02-06-2005, 05:09 PM I would say your problem is right here in the form action and onsubmit event...
The FORM parms are (Action=auxupdater.cgi, onSubmit= open.window(auxupdater.htm):
From what I see there is nothing in the onsubmit event to cancel the action of the form so the form will immediately submit too: auxupdater.cgi
It's hard to say how to deal with this situation without more information but I would think I would approach this problem by submitting to the perl script and having the perl script pop the alert, while continueing to poll the server until the update is complete and then auto-close the popup and transfer or update the parent from there... In other words... I believe your solution lies in how your cgi script handles the form submit...
......Willy
|
|
|
|
|