R
Rodney King
Hi,
I have developed an ASP page which dynamically displays a list of
checkbox options based on a SQL statement. Here is my code:
<div style="OVERFLOW:auto; Height: 150px">
<table>
<%
dim adOpenForwardOnly, adLockReadOnly
dim adCmdTable, ctr, checkboxID
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
dim objConn, objRS, cmdType
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open("tanklink")
set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConn
objCommand.CommandType = 1
objCommand.CommandTimeout = 10
objCommand.CommandText = Session("newSQL")
objCommandType = adCmdText
set objRS = objCommand.Execute
while not objRS.EOF
ctr = ctr + 1
checkboxID = "tank_chkbox"
Response.Write "<tr>"
Response.Write "<td width='20px'>"
Response.Write "<input type='checkbox' name='"
& checkboxID & "' id='" & checkboxID & "' value='" & objRS("tankid")
&"' />"
Response.Write "</td>"
Response.Write "<td width='200px'>"
Response.Write objRS("Name")
Response.Write "</td>"
Response.Write "</tr>"
objRS.MoveNext
wend
objRS.Close
objConn.Close
set objRS = Nothing
set objConn = Nothing
%>
</table>
</div>
My code displays properly, but I am having trouble writing a function
or a procedure that will parse through the list of checkboxes to see
which checkbox is checked when a submit button is pressed. Can
someone please provide some sample code to get me started?
Response.Form("tank_chkbox") does not seem to work and gives me an
error when I try and use it.
Thanks
I have developed an ASP page which dynamically displays a list of
checkbox options based on a SQL statement. Here is my code:
<div style="OVERFLOW:auto; Height: 150px">
<table>
<%
dim adOpenForwardOnly, adLockReadOnly
dim adCmdTable, ctr, checkboxID
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
dim objConn, objRS, cmdType
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open("tanklink")
set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConn
objCommand.CommandType = 1
objCommand.CommandTimeout = 10
objCommand.CommandText = Session("newSQL")
objCommandType = adCmdText
set objRS = objCommand.Execute
while not objRS.EOF
ctr = ctr + 1
checkboxID = "tank_chkbox"
Response.Write "<tr>"
Response.Write "<td width='20px'>"
Response.Write "<input type='checkbox' name='"
& checkboxID & "' id='" & checkboxID & "' value='" & objRS("tankid")
&"' />"
Response.Write "</td>"
Response.Write "<td width='200px'>"
Response.Write objRS("Name")
Response.Write "</td>"
Response.Write "</tr>"
objRS.MoveNext
wend
objRS.Close
objConn.Close
set objRS = Nothing
set objConn = Nothing
%>
</table>
</div>
My code displays properly, but I am having trouble writing a function
or a procedure that will parse through the list of checkboxes to see
which checkbox is checked when a submit button is pressed. Can
someone please provide some sample code to get me started?
Response.Form("tank_chkbox") does not seem to work and gives me an
error when I try and use it.
Thanks