ASP re-direct question...

D

David

Hi,

I have an asp page which basically takes some data from a previous
page form and inserts the data to my database and then does a
re-direct to:

Response.Redirect "JS_Create.asp"

On this page is just an animated logo saying something like 'Loading
Data ....'

On this asp page JS_Create.asp I have another re-direct handled by a
timer to go to JobSheet.asp.

The idea is that the user enters data into the form, if the form is
validated correctly, they are transferred to the next page which tells
them the data is loading. They are held there for say 3 to 5 seconds
and then transferred to the final page JobSheet.asp.

The code I have on JS_Create.asp for the timed re-direct is:

___________________________

<%
Sub Delay(DelaySeconds)
SecCount = 0
Sec2 = 0
While SecCount < DelaySeconds + 1
Sec1 = Second(Time())
If Sec1 <> Sec2 Then
Sec2 = Second(Time())
SecCount = SecCount + 1
End If
Wend
End Sub
%>

later in the page I have:

<%
Delay(5)
Response.Redirect "JobSheet.asp"
%>

____________________

The problem is that once the form is submitted, the page does not
change to JS_Create.asp, it just sits there on the form for the 3 to 5
seconds and then jumps immediately to JobSheet.asp. I want
JS_Create.asp to be displayed first.

Where should I place the asp or change it for this to occur ?

Appreciate your help.


David
 
L

Larry Woods

Here's a way:

A couple of points... The writing of the spaces is a "fix" for IE. You
can't use the redirect because you have already sent headers back to the
browser via the "flush", which you need to get the "Waiting..." displayed.
The introduction of the javascript into the output stream takes care of
redirecting to the final page.

CODE:

<html><head/>

<%
' Sub Delay is NOT changed in any way from your original code.
Sub Delay(DelaySeconds)
SecCount = 0
Sec2 = 0
While SecCount < DelaySeconds + 1
Sec1 = Second(Time())
If Sec1 <> Sec2 Then
Sec2 = Second(Time())
SecCount = SecCount + 1
End If
Wend
End Sub
%>

<body>
Waiting...
</body>
<%
' spaces for IE
response.write space(256)
' makes sure that previous text is displayed
response.flush()
Delay(5)
' adds javascript to stream
response.write "<script
language=javascript>location.href='JobSheet.asp';</script>"
' following line of code can't be used...
'Response.Redirect "JobSheet.asp"
%>
</html>
 
L

Larry Bud

Hi,

I have an asp page which basically takes some data from a previous
page form and inserts the data to my database and then does a
re-direct to:

Response.Redirect "JS_Create.asp"

On this page is just an animated logo saying something like 'Loading
Data ....'

Why in the world would you want to slow the user down by 5 seconds for
every data entry form?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,790
Messages
2,569,637
Members
45,348
Latest member
RoscoeNevi

Latest Threads

Top