ASP re-direct question...

Discussion in 'ASP General' started by David, Oct 21, 2004.

  1. David

    David Guest

    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
     
    David, Oct 21, 2004
    #1
    1. Advertising

  2. David

    Larry Woods Guest

    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>


    "David" <> wrote in message
    news:...
    > 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
     
    Larry Woods, Oct 21, 2004
    #2
    1. Advertising

  3. David

    Larry Bud Guest

    (David) wrote in message news:<>...
    > 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?
     
    Larry Bud, Oct 21, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    1
    Views:
    491
    Steven Cheng[MSFT]
    Jul 5, 2005
  2. Berlin Brown
    Replies:
    5
    Views:
    940
    Darryl L. Pierce
    Jan 25, 2004
  3. Remco van Engelen

    C grammar for direct-declarator question

    Remco van Engelen, Sep 14, 2006, in forum: C Programming
    Replies:
    5
    Views:
    394
    Michael Mair
    Sep 14, 2006
  4. Not a direct question in C

    , Jun 27, 2008, in forum: C Programming
    Replies:
    1
    Views:
    253
    Jens Thoms Toerring
    Jun 27, 2008
  5. Randell D.
    Replies:
    7
    Views:
    100
    Michael Winter
    Jul 8, 2005
Loading...

Share This Page