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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing a repeating list upon return

Status
Not open for further replies.

FredPeters

IS-IT--Management
Apr 30, 2002
10
CA
When returning to a repeating record page after being directed to a
detail/update or delete page, the variable used is still in my URL
string after the .asp? and the next "go to record" is tacked onto
the end of the last request and the page, obviously is not found.
What is the best way to clear this variable so it goes back to the
original page, ready to recieve a new request.

Thanks in Advance
Fred

And in the end,
the love you take
is equal to the love you make
 
What method are you using to return to the master page.

a history return a straight link or what? Maybe post the code from your detail page so we can maybe see what is causing it.

Cheech [Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
I am redirecting the user back to the list page after modifying the data, as opposed through the history page. Using the history will not show updated data while the redirect shows the username just visited after the .asp?

The code is as follows.
TIA
Fred
<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<!--#include file=&quot;../../Connections/ACCESSORY1.asp&quot; -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=&quot;admin&quot;
MM_authFailedURL=&quot;../../qualify/access/unauthorized.asp&quot;
MM_grantAccess=false
If Session(&quot;MM_Username&quot;) <> &quot;&quot; Then
If (false Or CStr(Session(&quot;MM_UserAuthorization&quot;))=&quot;&quot;) Or _
(InStr(1,MM_authorizedUsers,Session(&quot;MM_UserAuthorization&quot;))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = &quot;?&quot;
If (InStr(1,MM_authFailedURL,&quot;?&quot;) >= 1) Then MM_qsChar = &quot;&&quot;
MM_referrer = Request.ServerVariables(&quot;URL&quot;)
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & &quot;?&quot; & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & &quot;accessdenied=&quot; & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables(&quot;SCRIPT_NAME&quot;))
If (Request.QueryString <> &quot;&quot;) Then
MM_editAction = MM_editAction & &quot;?&quot; & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = &quot;&quot;
%>
<%
' *** Update Record: set variables

If (CStr(Request(&quot;MM_update&quot;)) = &quot;form1&quot; And CStr(Request(&quot;MM_recordId&quot;)) <> &quot;&quot;) Then

MM_editConnection = MM_ACCESSORY1_STRING
MM_editTable = &quot;tuser&quot;
MM_editColumn = &quot;username&quot;
MM_recordId = &quot;'&quot; + Request.Form(&quot;MM_recordId&quot;) + &quot;'&quot;
MM_editRedirectUrl = &quot;usersact.asp&quot;
MM_fieldsStr = &quot;actuser|value|program|value|mary|value|data|value|sync|value|trained|value&quot;
MM_columnsStr = &quot;ActUser|none,1,0|program|none,1,0|mary|none,1,0|data|none,1,0|sync|none,1,0|trained|none,1,0&quot;

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, &quot;|&quot;)
MM_columns = Split(MM_columnsStr, &quot;|&quot;)

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

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

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request(&quot;MM_update&quot;)) <> &quot;&quot; And CStr(Request(&quot;MM_recordId&quot;)) <> &quot;&quot;) Then

' create the sql update statement
MM_editQuery = &quot;update &quot; & MM_editTable & &quot; set &quot;
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),&quot;,&quot;)
MM_delim = MM_typeArray(0)
If (MM_delim = &quot;none&quot;) Then MM_delim = &quot;&quot;
MM_altVal = MM_typeArray(1)
If (MM_altVal = &quot;none&quot;) Then MM_altVal = &quot;&quot;
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = &quot;none&quot;) Then MM_emptyVal = &quot;&quot;
If (MM_formVal = &quot;&quot;) Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> &quot;&quot;) Then
MM_formVal = MM_altVal
ElseIf (MM_delim = &quot;'&quot;) Then ' escape quotes
MM_formVal = &quot;'&quot; & Replace(MM_formVal,&quot;'&quot;,&quot;''&quot;) & &quot;'&quot;
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & &quot;,&quot;
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & &quot; = &quot; & MM_formVal
Next
MM_editQuery = MM_editQuery & &quot; where &quot; & MM_editColumn & &quot; = &quot; & MM_recordId

If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject(&quot;ADODB.Command&quot;)
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> &quot;&quot;) Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim rsusersact__MMColParam
rsusersact__MMColParam = &quot;1&quot;
If (Request.QueryString(&quot;username&quot;) <> &quot;&quot;) Then
rsusersact__MMColParam = Request.QueryString(&quot;username&quot;)
End If
%>
<%
Dim rsusersact
Dim rsusersact_numRows

Set rsusersact = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsusersact.ActiveConnection = MM_ACCESSORY1_STRING
rsusersact.Source = &quot;SELECT * FROM tuser WHERE username = '&quot; + Replace(rsusersact__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
rsusersact.CursorType = 0
rsusersact.CursorLocation = 2
rsusersact.LockType = 3
rsusersact.Open()

rsusersact_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<form name=&quot;form1&quot; method=&quot;POST&quot; action=&quot;<%=MM_editAction%>&quot;>
<table width=&quot;217&quot; border=&quot;1&quot; align=&quot;center&quot;>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>First
Name</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>&nbsp;<%=(rsusersact.Fields.Item(&quot;firstname&quot;).Value)%></font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Surname</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>&nbsp;<%=(rsusersact.Fields.Item(&quot;surname&quot;).Value)%></font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Username</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><%=(rsusersact.Fields.Item(&quot;username&quot;).Value)%></font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Branch</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><%=(rsusersact.Fields.Item(&quot;branch&quot;).Value)%></font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Act
User</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
<input <%If (CStr((rsusersact.Fields.Item(&quot;ActUser&quot;).Value)) = CStr(&quot;True&quot;)) Then Response.Write(&quot;checked&quot;) : Response.Write(&quot;&quot;)%> name=&quot;actuser&quot; type=&quot;checkbox&quot; id=&quot;actuser&quot; value=&quot;checkbox&quot;>
</font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Program</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
<input <%If (CStr((rsusersact.Fields.Item(&quot;program&quot;).Value)) = CStr(&quot;True&quot;)) Then Response.Write(&quot;checked&quot;) : Response.Write(&quot;&quot;)%> name=&quot;program&quot; type=&quot;checkbox&quot; id=&quot;program&quot; value=&quot;checkbox&quot;>
</font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>On
Mary's</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
<input <%If (CStr((rsusersact.Fields.Item(&quot;mary&quot;).Value)) = CStr(&quot;True&quot;)) Then Response.Write(&quot;checked&quot;) : Response.Write(&quot;&quot;)%> name=&quot;mary&quot; type=&quot;checkbox&quot; id=&quot;mary&quot; value=&quot;checkbox&quot;>
</font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Data
in </strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
<input <%If (CStr((rsusersact.Fields.Item(&quot;data&quot;).Value)) = CStr(&quot;True&quot;)) Then Response.Write(&quot;checked&quot;) : Response.Write(&quot;&quot;)%> name=&quot;data&quot; type=&quot;checkbox&quot; id=&quot;data&quot; value=&quot;checkbox&quot;>
</font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Sync's
properly </strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
<input <%If (CStr((rsusersact.Fields.Item(&quot;sync&quot;).Value)) = CStr(&quot;True&quot;)) Then Response.Write(&quot;checked&quot;) : Response.Write(&quot;&quot;)%> name=&quot;sync&quot; type=&quot;checkbox&quot; id=&quot;sync2&quot; value=&quot;checkbox&quot;>
</font></div></td>
</tr>
<tr>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;right&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><strong>Trained</strong></font></div></td>
<td align=&quot;default&quot; width=&quot;50%&quot;><div align=&quot;left&quot;><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
<input <%If (CStr((rsusersact.Fields.Item(&quot;trained&quot;).Value)) = CStr(&quot;True&quot;)) Then Response.Write(&quot;checked&quot;) : Response.Write(&quot;&quot;)%> name=&quot;trained&quot; type=&quot;checkbox&quot; id=&quot;trained&quot; value=&quot;checkbox&quot;>
</font></div></td>
</tr>
</table>
<p align=&quot;center&quot;> <font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>
<input name=&quot;Update&quot; type=&quot;submit&quot; id=&quot;Update&quot; value=&quot;Submit&quot;>
</font></p>
<input type=&quot;hidden&quot; name=&quot;MM_update&quot; value=&quot;form1&quot;>
<input type=&quot;hidden&quot; name=&quot;MM_recordId&quot; value=&quot;<%= rsusersact.Fields.Item(&quot;username&quot;).Value %>&quot;>
</form>
</body>
</html>
<%
rsusersact.Close()
Set rsusersact = Nothing
%>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top