Link to home
Start Free TrialLog in
Avatar of J-Mik
J-Mik

asked on

Detect when form submission is complete

I have a form which submits to a page on a server that takes a few minutes to load and process the data. During which time, most browsers display the progress bar at the bottom. When the server is done processing the info, it returns a "204 No Content" and the browser stops. I need to detect when this has happened, so I can redirect to another page. I can't change the way the server responds, so this will have to be implemented client-side, presumably using Javascript. Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of devic
devic
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of J-Mik
J-Mik

ASKER

Devic,

This doesn't seem to work. The onLoad event of the IFRAME triggers as soon as the page with the form loads (before the submitting happens) and then does not trigger again even after the form is submitted through it.
that happens, because you changed my code or you are using only a part of this.
show me what you do, and I tell you what is wrong
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of J-Mik

ASKER

Well, I don't think I changed anything, but here's the code anyways:

 <SCRIPT TYPE="text/javascript">
 <!--
                                       
   function Check() {
     var HREF;
     try {
       HREF = frames.HFrame.location.href;
     } catch(Err) {
       HREF = "Access Denied";
     }
     if (HREF != 'about:blank') { alert(HREF); }
   }
                                       
 //-->
</SCRIPT>

<FORM ACTION="default.asp" METHOD="Post" TARGET="HFrame">
<TABLE CELLPADDING=0 CELLSPACING=10 BORDER=0 ALIGN="Center">
   <TR VALIGN="Middle">
     <TD><INPUT TYPE="Text" SIZE=20 MAXLENGTH=20 ID="Username" NAME="Username"></TD>
     <TD ROWSPAN=2 ALIGN="Center"><INPUT TYPE="Image" SRC="/Button-Submit.gif"></TD>
  </TR>
   <TR>
     <TD><INPUT TYPE="Password" SIZE=20 MAXLENGTH=20 ID="UserPass" NAME="UserPass"></TD>
  </TR>
</TABLE>                                            

</FORM>
<IFRAME NAME="HFrame" ID="HFrame" SRC="about:blank" onLoad="Check()"></IFRAME>


I tested this in Internet Explorer, Firefox and Opera, and in all three cases, the function is not run when the form is done submitting. Don't forget that the server does not return a blank page, it return a 204, which means the IFRAME's location never changes. Thanks again.
can you give the full url of the action?
Avatar of J-Mik

ASKER

Devic,
"default.asp" is the full URL. It's an IIS page hosted on the same machine that this page runs on, in the local Intranet.

GwynforWeb,
Thanks for the try, but your code doesn't change anything. The function still isn't called a second time (again, probably because the page is not loaded)
the same machine....
why you don't use  Response.Redirect ?
Avatar of J-Mik

ASKER

Devic,

As I mentionned, I cannot change the server's script at all, so this is not an option. :)
J-Mik,

then I would say you can not do nothing...

or probably you must ask the people, who can change this file ;)