Reputation: 1118
I have an ASP Classic page which has a button that then opens a popup (just a test for now) to execute a query. However, this query is never executed (also the Response.Write
is not showing up). Why is this not executing?
Here is the code from the main page. I double-checked and the correct values are being passed to the function.
function clearAssignment(assignmentID,docrecid)
{
window.open("procclearassignment.asp?assignmentID="+assignmentID+"&docrecid="+docrecid,"",'width=375,height=220');
}
<INPUT TYPE="button" class = "sbtn" name="clearassignment" Value="Clear" target="_self" onclick = "clearAssignment(<%=assignmentID%>,<%=docrecid%>);"/>
Here is the process:
<!--#include file="content/securityheader.asp"-->
<!--#include file="connection.inc"-->
<!--#include file="connectionxref.inc"-->
<!--#include file="securityheader.asp"-->
<!--#include file="connectionSQL.inc"-->
<% 'SQL SECURITY CODE
function dbencodeStr(str)
thestr = trim(replace(str,"'","'"))
thestr = trim(replace(thestr,"""","""))
thestr = trim(replace(thestr,"<","<"))
thestr = trim(replace(thestr,">",">"))
thestr = trim(replace(thestr,vbCRLF,"<BR>"))
dbencodeStr = thestr
end function
%>
<%
Server.ScriptTimeout=3600
'------------------------------
Function getName(str)
index = instr(str," ")
if index > 0 then
str = trim(mid(str,1,index))
end if
getName = str
End Function
'------------------------------
on error resume next
assignmentID = dbencodeStr(request.Form("assignmentID"))
docid = dbencodeStr(request.Form("docrecid"))
thedate = now()
if docid <> "" Then
''''Close any open assignments for the document
strSQL = "update RelDocAssignments set activeflag = 0, closedOn = getdate() where docid = '"&docid&"' and ID = '"&assignmentID&"';"
Set rs = objConnection.Execute(strSQL, ,adCmdText)
end if
Response.write(strSQL)
''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''
objConnection.close
set objConnection = nothing
objConnection2.close
set objConnection2 = nothing
objConnection3.close
set objConnection3 = nothing
%>
Upvotes: 1
Views: 81
Reputation: 16311
You appear to be passing your values via url/querystring:
window.open("procclearassignment.asp?assignmentID="+assignmentID+...
But you're retrieving them as if they were POSTed:
assignmentID = dbencodeStr(request.Form("assignmentID"))
I think you want:
assignmentID = dbencodeStr(request.QueryString("assignmentID"))
instead.
Upvotes: 4