Forums

This topic is locked

After update or insert redirect to results ?

Posted 19 Aug 2002 02:28:48
1
has voted
19 Aug 2002 02:28:48 Herman Van Aken posted:
It must be simple...but i'm stuck now! After a insert or update submission the visitor must instantly redirect to the results pageview. My problem is:
How I send a look alike "go to detailpage" within my redirect url ? All other stuff for doing this is no problem

Edited by - vilvoord on 19 Aug 2002 02:30:37

Replies

Replied 19 Aug 2002 21:52:39
19 Aug 2002 21:52:39 David Behan replied:
I am unsure what you mean but it seems like you want to do a redirect without the user needing to click a button!!

If you want to redirect to another page on insert.... after the insert use Response.Redirect("otherpage.asp".

Please explain more if that doesn't help.

Regards,


Dave

_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
Replied 19 Aug 2002 23:51:02
19 Aug 2002 23:51:02 Herman Van Aken replied:
When there is a insert or update record form, you can choose in the server behavior the redirectpage (after update go to...). In my case is this page a resultpage. So...a example: there is a resultpage with employees info...name email departement etc...
every employee (record) has his own unique ID. When a employee (ID=210) update his record via a updateform submission...the rederictpage must showing the resultpage with ID210. This employee sees direct after the submission his own record to control his update information. So I must pass this ID within the redirect url in the update form so the resultpage showing only employe ID210. How to add the ID into the redirect url?

Edited by - vilvoord on 19 Aug 2002 23:52:34

Edited by - vilvoord on 19 Aug 2002 23:56:21

Edited by - vilvoord on 19 Aug 2002 23:59:50
Replied 20 Aug 2002 00:03:04
20 Aug 2002 00:03:04 David Behan replied:
For an update form this is pretty easy to do. Just include in your redirect url:

"redirectpage.asp?id=" & rsUser.Fields.Item("id".Value

as the redirect url. Search for the line:

MM_editRedirectUrl = "page_view.asp"


It's on about line 47.


For the insert method you can take out the line that actually does the redirect, filter the database and sort it by latest entry first and extract the id and then do a redirect using:

Response.Redirect("redirectpage.asp?id=" & rsUser.Fields.Item("id".Value)

Hope that helps

Dave

_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
Replied 20 Aug 2002 01:43:26
20 Aug 2002 01:43:26 Herman Van Aken replied:
Thanks for your quick awnser !

For the insert record I understand !

But for the updaterecord it doesn't work....:

Ived set in my MM_editRedirectUrl= " /vanaken/naup.asp?fld_Familie_ID= "& updatenaar (name of my recordset).Fields.Item("fld_Familie_ID" -name of my IDField- .Value

I repeat for you :
MM_editRedirectUrl = "/vanaken/naup.asp?fld_Familie_ID="& updatenaar.Fields.Item("fld_Familie_ID".value

The updateform apears but after submitting I get a error:

"Microsoft VBScript runtime error '800a01a8'
Object required: 'updatenaar'

Whats happening ?

Thanks for a quick awnser


Edited by - vilvoord on 20 Aug 2002 01:49:21
Replied 20 Aug 2002 10:20:43
20 Aug 2002 10:20:43 David Behan replied:
You must delete these lines:

If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If


They appear around 113-115. In their place you must insert your new recordset that sorts by last record first. Then when you pull out the information you will have the record you just inserted into it. Think about it. The script must first insert the new record, filter the database with the new record in it and select the last entry, and redirect using the id of the variable in it.

Does that make sense?

_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
Replied 20 Aug 2002 12:41:14
20 Aug 2002 12:41:14 Herman Van Aken replied:
In my case this is the following code:

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If

What must I chanche (for my case) in this code ?
Can you give me a sample so I can learn abouth it?

Thanks again.
Replied 20 Aug 2002 13:26:45
20 Aug 2002 13:26:45 David Behan replied:
Don't worry about those lines. They don't actually do the redirect they just form the redirect url.

What you need to delete is the lines below:

If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If

on about line 113-115. They do the actual redirection. If you delete them, it won't redirect. Then in its place put in a recordset like this:



'***************************************

Dim rsNewUser
Dim rsNewUser _numRows

Set rsNewUser = Server.CreateObject("ADODB.Recordset"
rsNewUser .ActiveConnection = MM_connect_STRING
rsNewUser .Source = "SELECT * FROM TBL_USERS ORDER BY USER_ID DESC"
rsNewUser .CursorType = 0
rsNewUser .CursorLocation = 2
rsNewUser .LockType = 1
rsNewUser .Open()

rsNewUser _numRows = 0

Response.Redirect("redirectpage.asp?id=" & rsUser.Fields.Item("USER_ID".Value)

'***************************************


Hope that helps.



_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
Replied 20 Aug 2002 14:01:37
20 Aug 2002 14:01:37 Herman Van Aken replied:
I have delete the code between If>End
and set under my recordset :

Response.Redirect("/vanaken/naup.asp?id=" & updatenaar.Fields.Item("fld_Familie_ID".Value)

I get a error : expect: 'End'
in line 730

I lose myselfs fait...
Is there no simple way to do it ?
Replied 20 Aug 2002 14:01:38
20 Aug 2002 14:01:38 Herman Van Aken replied:
I have delete the code between If>End
and set under my recordset :

Response.Redirect("/vanaken/naup.asp?id=" & updatenaar.Fields.Item("fld_Familie_ID".Value)

I get a error : expect: 'End'
in line 730

I lose myselfs fait...
Is there no simple way to do it ?
Replied 20 Aug 2002 14:57:59
20 Aug 2002 14:57:59 Vince Baker replied:
You have some brackets missing from your code:

(updatenaar.Fields.Item("fld_Familie_ID".value)

It thought that ukdatenaar was a field not the recordset as the brackets where missing.

Vince

Replied 20 Aug 2002 15:12:05
20 Aug 2002 15:12:05 Vince Baker replied:
(The first bracket is what is missing)

<% Response.write(The best line of code you can ever use"%>

Vince
VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 20 Aug 2002 15:25:43
20 Aug 2002 15:25:43 David Behan replied:
The line he has is correct

Response.Redirect("/vanaken/naup.asp?id=" & updatenaar.Fields.Item("fld_Familie_ID".Value)

After this line type

END IF

and try again.

I think that might fix it

_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
Replied 21 Aug 2002 00:48:55
21 Aug 2002 00:48:55 Herman Van Aken replied:
It's all confused now !

I try every sugestion...no results!
always errors also on 'End If'
Please help!
Replied 21 Aug 2002 01:27:33
21 Aug 2002 01:27:33 David Behan replied:
Post up entire code for the page here so I can have a look.

Thanks

_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com
Replied 21 Aug 2002 22:54:50
21 Aug 2002 22:54:50 Herman Van Aken replied:
Ived send you a email with the code because it's was to long to insert on UDzone

Thanks in advance

Edited by - vilvoord on 21 Aug 2002 22:55:51
Replied 22 Aug 2002 01:43:48
22 Aug 2002 01:43:48 Herman Van Aken replied:
I haved find it !

Great stuff and it works !
(The solution cames from The UDzone)
Everywhone Thanks !

BUT HOW IT WORKS WITH PURE ASP UPLOAD ???????

Reply to this topic