Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

on last record redirect to another page 1

Status
Not open for further replies.

evr72

MIS
Dec 8, 2009
265
US
hello,
I have an input form that users can fill out, then they can go back and edit their answers
Is there a way that when the user gets to the last question
can it be redirected to another page. I know that in a regular input form your just do a response.redirect.

but this is an edit page. When the user revises his answers he/she can edit the answers and move on to the next question. but at the end of the questions I would like to redirect them to a signature page not sure how to approach this one
 
The page must be submitted. Roughly you do this:

Code:
<form action=signature.asp method=post>
Name: <input type=text name=fName>
Emailaddress:  <input type=text name=fEmail>
<input type=submit value=OK>
</form>

 
foxbox,

thanks for the suggestion, that would work well for a regular input form, on my edit form, each question can be edited, hence each question has a submit button. If I were to do that every question would redirect to the signature.asp page.
could I do somelthing like this
Code:
Set RS = conn.Execute( "SELECT MAX(itm) FROM table" ) 
maxid = RS(0) RS.Close
 
If maxid = itm Then Response.Redirect "signature.asp"

 
each question can be edited, hence each question has a submit button"

code plz.
if every question has i submit, so should be able to submit the last question to signature.asp?
 
yes, but the number of questions can change at any time.

and I don't want to redirect the user to the signature page until the last question.
 
so you must determine the number of questions, and eg set a session variable with that number or put that number in a hidden field.
After each edit action you check if it was an answer to the last question, and if yes redirect.
There is one question on screen or more? If more, how do you prevent me from answering the last question FIRST? (which result in a unwanted redirect)
 
That is the problem, there is no way to determine how many questions.

 
there is no way to determine how many questions."

Sure there is. You are writing the questions. You can determine how many you write.

The easiest way out I think would be an additional button. Failing a complete overhaul, keep your submit buttons on each question that submit the edited answers.

Then instead of trying to do things automagically, add a separate "I'm all done editing- take me to the signature page please" button on the bottom.
 
BigRed1212,

I proposed the idea, but it was not very well received. The comment was, but then the user can click the "Take to the signature" button at any time

what I was thinking, I have seen a few applications that have navigation buttons. back, forward, first record, last record. If you get to the last record the forward button dissapears. Has anybody else seen this kind of navigation?
Anyhow I thougt I might be able to use that, in stead of dissapearing, changing to "Go to signature page" or something like that

like I mention above I also tried
Code:
Set RS = conn.Execute( "SELECT MAX(itm) FROM table" ) 
maxid = RS(0) RS.Close
 
If maxid = itm Then Response.Redirect "signature.asp"
 
I think I almost got it

I added the following code

Code:
Set rstmp = CustomQuery("SELECT MAX(itm) FROM answers") 
maxid = rstmp(0) rstmp.close
set rstmp=nothing

If maxid = keys("itm") Then Response.Redirect("signature.asp")

but I get an error
Microsoft VBScript compilation error: Expected end of statement in line 13

line 13 is
Code:
maxid = rstmp(0) rstmp.close

no idea why
 
write them on 2 seperate lines:

Code:
maxid = rstmp(0) 
rstmp.close

 
I got it,
Code:
every element has to be on their own line

Set rstmp = CustomQuery("SELECT MAX(itm) FROM answers") 
maxid = rstmp(0) 
rstmp.close
set rstmp=nothing

If maxid = keys("itm") Then Response.Redirect("signature.asp")

this works well, as long as I am in the last question I will be redirected.


Thank all!!!! I really appreciate the help and pointers!!!
 
What happens if you answer the last question first as was asked earlier?
 
if you answer the last question first it will take you to the signature.asp page, could not find another way to do it. the other option as somebody suggested was to put a button for signature, then the user can go to that page at any time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top