|
| |
|
|
mdafonz
Posts: 17 Joined: 1/25/2004 Status: offline
|
redirect after form submit - 1/26/2004 13:12:59
Hi, another newbie question. How do you redirect the user to a page after they submit a form? I also want to be able to pass a parm to the target page. -MF
|
|
|
|
BeTheBall
Posts: 6502 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: redirect after form submit - 1/26/2004 13:52:45
Are we talking Classic ASP or Frontpage DRW? Also, what parameter are you wanting to pass?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
mdafonz
Posts: 17 Joined: 1/25/2004 Status: offline
|
RE: redirect after form submit - 1/26/2004 15:26:09
I'm using Frontpage DRW. The parameter that I want to pass to the target page is one of the values submitted by the form. But it is also the same value of a link that brings the user to the form. Eg: a link on results.asp with url "edit.asp?ID=abc" brings the user to edit.asp. The form passes a the hidden value, ID, to the database. The submit button there should return them back to "results.asp?ID=abc". This relates to another post I had... could you put the parameter in when it asks you for the confirmation page url under form properties? -MF
< Message edited by mdafonz -- 1/26/2004 16:15:31 >
|
|
|
|
BeTheBall
Posts: 6502 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: redirect after form submit - 1/26/2004 16:18:26
So is there another page involved? Meaning, does the form on edit.asp submit to yet another page? If so, I would try a Meta Refresh tag on that page. It would look something like this: <META HTTP-EQUIV="refresh" content="2;URL=http://www.yoursite.com/results.asp?ID=<%=Request.Form("ID")%>">
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
mdafonz
Posts: 17 Joined: 1/25/2004 Status: offline
|
RE: redirect after form submit - 1/26/2004 16:24:57
No, the form on edit.asp submits to a database file. I just want it to go back to results.asp with the ID parm and not to the auto-gen'd confirmation page... -MF
|
|
|
|
BeTheBall
Posts: 6502 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: redirect after form submit - 1/26/2004 16:43:04
OK, my mistake. Since the page was called edit.asp I assumed you were updating a record, not submitting one. Can you post the code for edit.asp?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
mdafonz
Posts: 17 Joined: 1/25/2004 Status: offline
|
RE: redirect after form submit - 1/26/2004 17:07:46
ok...
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear
strErrorUrl = ""
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear
Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"
Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"
fp_conn.Open Application("hardware_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "CPU", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"
fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(3)
Dim arFormDBFields0(3)
Dim arFormValues0(3)
arFormFields0(0) = "ID"
arFormDBFields0(0) = "ID"
arFormValues0(0) = Request("ID")
arFormFields0(1) = "CPU_Model"
arFormDBFields0(1) = "CPU_Model"
arFormValues0(1) = Request("CPU_Model")
arFormFields0(2) = "CPU_Manufacturer"
arFormDBFields0(2) = "CPU_Manufacturer"
arFormValues0(2) = Request("CPU_Manufacturer")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"
fp_rs.Close
fp_conn.Close
FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"edit.asp",_
"Return to the form."
End If
End If
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="hardware" S-RecordSource="CPU" U-Database-URL="hardware_db/hardware_db.mdb" S-Form-Fields="ID CPU_Model CPU_Manufacturer" S-Form-DBFields="ID CPU_Model CPU_Manufacturer" -->
<table><tr><td width="150"><p style="font-weight: bold">CPU Manufacturer:</p></td>
<td><input type="text" name="CPU_Manufacturer" size="20"></td></tr>
<tr><td width="150"><p style="font-weight: bold">CPU Model:</p></td>
<td><input type="text" name="CPU_Model" size="30"></td></tr>
<tr><td><input type="submit" value="Submit" name="submit_cpu"></td></tr></table>
<input type="hidden" name="ID" value="<%=Request.querystring("ID")%>">
</form>
</body></html>
That's everything.
|
|
|
|
BeTheBall
Posts: 6502 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: redirect after form submit - 1/26/2004 17:31:27
Do this: Right click your form (on Edit.asp). Choose "Form Properties". Then click the "Options" button. In the URL for the confirmation page, enter: results.asp?ID="&Request.Form("ID")&"
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
mdafonz
Posts: 17 Joined: 1/25/2004 Status: offline
|
RE: redirect after form submit - 1/26/2004 19:20:31
it works, thanks!
|
|
|
|
yrag
Posts: 1 Joined: 1/6/2009 Status: offline
|
RE: redirect after form submit - 1/6/2009 19:13:09
This redirects as soon as you visit the page, do you have the code for it to redirect after the form has been submitted? thanks in advance, im desperate for the code!!! Find the form on my website - http://www.drawya.com quote:
ORIGINAL: BeTheBall <META HTTP-EQUIV="refresh" content="2;URL=http://www.yoursite.com/results.asp?ID=<%=Request.Form("ID")%>">
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|