Error Correction issues...

Results 1 to 2 of 2

Thread: Error Correction issues...

  1. #1
    Join Date
    Dec 1969

    Default Error Correction issues...

    I&#039;m having some problems figuring out how to error correct a couple pages I am working on.<BR><BR>I have "page1.asp" and "page2.asp". Page1.asp is a page with a form where the client inputs some data in text feilds. When they hit "Submit", they are transferred to Page2.asp, where the asp code is parsed.<BR><BR>What I want to have done is have it so if some or one of the text boxes is left empty, Page2.asp shows an error message, telling the client what feilds were not entered, with a button that takes them back to Page1.asp. If the client fills in all the data, then Page2.asp will simply say "You have been registered. Thank you.", with some other links to other pages.<BR><BR>The problem is that I can&#039;t seem to get the code to do what I want. The error messages show up, but so does the "You have been Registered" text. I tried a Redirect, and that works... but it immediately pops Page1.asp back up with no error messages.<BR><BR>The code I have is as follows (just one feild with error code for example):<BR><BR>&#039;---Begin TimeZone Verification<BR>tzone=trim(request("TimeZone"))<BR >if tzone = "" then<BR> validationOk = false<BR> Response.Write ("No Time Zone Selected<BR>")<BR>end if<BR>&#039;--- End TimeZone Verification<BR><BR>if validationOK = false then<BR> &#039;Response.Write("Click back on your Browser to return to the Registration Page")<BR> Response.Redirect "fltreg.asp"<BR>else<BR><BR>Dim conn<BR>Dim conn1<BR>Dim ConStr<BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>ConStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("Test.mdb")<BR>conn.Open(ConStr)<BR ><BR><BR>Thanks in advance for any help...

  2. #2
    Join Date
    Dec 1969

    Default Fundamenal problems

    You CANNOT *both* show a message *AND* do Response.Redirect!<BR><BR>See the ASPFAQs.<BR><BR>If you want to do it the way you are doing, you will have to do the move back to page1 on the *client*.<BR><BR>But I think your whole concept is wrong.<BR><BR>Instead of posting from page1.asp to page2.asp, post from page1.asp to PAGE1.ASP!! The same page!<BR><BR>Now, if you find missing data, you can put a little message in RED (say) right in the form page, pointing to the missing info.<BR><BR>Plus, now you still have the form info, so you can fill the form in with what the user entered before. With your scheme, the user would have to START ALL OVER entering data into the form!<BR><BR>*IF* you discover that the user posted *good* data, *then* you do the work needed to put the info into the DB and *then* you finally redirect to the next page in sequence.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts