Wrox Home  
Search P2P Archive for: Go

  Return to Index  

html_code_clinic thread: Go back a page


Message #1 by "Sam E. Johnston II" <sam.johnston@j...> on Thu, 6 Feb 2003 10:06:39 -0500
I think that is it.  I did not know how to put the java "mid script" in
the asp.  Let me try this now!!  Tks!

-----Original Message-----
From: Imar Spaanjaars [mailto:Imar@S...] 
Sent: Wednesday, February 12, 2003 4:18 PM
To: HTML Code Clinic
Subject: [html_code_clinic] Re: Go back a page


My first solution should do just that.

Consider this:


<%
         ' Check data etc etc
         If DataIsInValid Then
                 Response.Write("You made an error <br />")
                 Response.Write("Please press the Go Back button and 
correct any mistakes....<br />")
                 Response.Write("<input type=""button"" 
onclick=""JavaScript:history.go(-1);"" value=""Go Back"" />")
         Else
                 ' Do Database insert
                 ' Send them to thank you page or whatever
                 Response.Redirect("Test3.asp")
         End If
%>

Does this help??

Please note: instead of Response.Write you can also mix HTML :

         If DataIsInValid Then
         %>
                 HTML here
         <%
         Else

Please note 2: for the <input type="button"> to work, you may need to
wrap 
it in a <form> (for older browsers).

Cheers,


Imar



At 04:07 PM 2/12/2003 -0500, you wrote:
>Well, not quite yet.  I am running a pretty lengthy two page 
>application.  Works pretty good.
>
>Test1.asp was originally put together with FrontPage, but code is still

>useful (and lots of it; html, java and asp).  On submit, I point it to 
>my own test2.asp where I test the text box data submitted, and if OK, 
>SQL Insert it into a local database.
>
>If the input data does not test well, that's when I want asp to
>(perhaps) response.end and display a button to go back a page (without 
>loosing the inputted data as if they had hit the 'back' button on their

>browser.  With the code you suggested (big help!), I can send them back

>right away, but, I want to give them an explanation first.
>
>Does this make sense?
>
>Tks
>Sam




Tracking #: B83C86D82B71054D8EE973E3068803D3C206F0F7


  Return to Index