Process:
I have a form which uploads a file from client to server written in PHP.
When the user presses the submit button, I use the "onSubmit" event to
execute javascript to open a child window containing some text and an
animated GIF. The javascript returns 'True' and the file is uploaded. All of
that works great.
Problem:
Now I am trying to close the child window after the file has been uploaded.
Below is the JavaScript I'm using:
Observations:
Error Msg: "progress is undefined".
I have observed that after form submission the 'if' statement in the 'close
child window' code fails because the handle 'progress' appears to have no
value. My guess is that on form submission the handle 'progress' looses its'
value because the action for the form is to reload itself. The 'if' staement
does execute because I have placed an 'alert' statement just prior to it an
the 'alert' executed appropriately.
If I try to open the window after submitting the form, the page doesn't open
until after the file has been uploaded, which defeats the purpose.
Question:
How do I close the window after the form has been submitted?
Thanks for your help!
Irvin.
_______________ _______________ _______________ __________
Javascrtip Code:
_______________ _______________ _______________ __________
To open the child window:
<script language="javas cript">
var progress=null;
function sendfile() {
progress=window .open('test2.ht m','progress',' width=350,heigh t=475');
return true;
}
</script>
To close the child window:
This code follows my PHP code that verifies the file upload.
<script type="text/javascript" language="javas cript">
if (progress && !progress.close d) {
progress.close( );
}
</script>
_______________ _______________ _______________ ___________
I have a form which uploads a file from client to server written in PHP.
When the user presses the submit button, I use the "onSubmit" event to
execute javascript to open a child window containing some text and an
animated GIF. The javascript returns 'True' and the file is uploaded. All of
that works great.
Problem:
Now I am trying to close the child window after the file has been uploaded.
Below is the JavaScript I'm using:
Observations:
Error Msg: "progress is undefined".
I have observed that after form submission the 'if' statement in the 'close
child window' code fails because the handle 'progress' appears to have no
value. My guess is that on form submission the handle 'progress' looses its'
value because the action for the form is to reload itself. The 'if' staement
does execute because I have placed an 'alert' statement just prior to it an
the 'alert' executed appropriately.
If I try to open the window after submitting the form, the page doesn't open
until after the file has been uploaded, which defeats the purpose.
Question:
How do I close the window after the form has been submitted?
Thanks for your help!
Irvin.
_______________ _______________ _______________ __________
Javascrtip Code:
_______________ _______________ _______________ __________
To open the child window:
<script language="javas cript">
var progress=null;
function sendfile() {
progress=window .open('test2.ht m','progress',' width=350,heigh t=475');
return true;
}
</script>
To close the child window:
This code follows my PHP code that verifies the file upload.
<script type="text/javascript" language="javas cript">
if (progress && !progress.close d) {
progress.close( );
}
</script>
_______________ _______________ _______________ ___________
Comment