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!

Forms Question 1

Status
Not open for further replies.

tmishue

Programmer
Jun 26, 2001
35
0
0
US
I have a form on ASP1.asp when the form is submitted I do some validation on ASP2.asp. In the event that there is an error with the user input I want my ReturnToForm.btn to direct the user back to the form on ASP1.asp with all the information that they have already input in.

When I do
thisform.action = "ASP1.asp"
thisform.submit

it directs the user back to the form page however the form has been cleared. I want to do the equivalent of the Back button on Internet Explorer and return to the form that already has some info inputted in. Is there a way that I can do this?

Any help would be greatly appreciated.

Tammym
 
You could do exactly like the back button with history.back(). You could also set all the form fields to hidden html and resubmit them back to the previous page. In the previous page you will have to write a little bit more code to fill the user responses that are in the Request object.
Example:
Code:
<input type=&quot;text&quot; name=&quot;name&quot; value=&quot;<%= Request(&quot;name&quot;) %>&quot;>

Hope this helps. Wushutwist
 
I like the history.back () idea but I can't get it to work. Here is my code for the button, I'm really new to ASP and vbscript can someone help me with what I am missing.

Thanks,
tammym

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>

Sub retbtn_onclick()
thisform.action= history.back ()
thisform.submit
End Sub

</SCRIPT>
 
I figured it out.

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
Sub retbtn_onclick()
history.go (-1)
End Sub
</SCRIPT>


Thanks Sooooooo much for your help. You have no idea how much stress you saved me.

Thanks again,
tammym
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top