Classic ASP how to check a checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • classicNoob
    New Member
    • Sep 2015
    • 1

    Classic ASP how to check a checkbox

    Hello,
    I am working on some ancient code and am having a ton of issues try to figure out how to do some of the simplest thing with the classic asp.

    I have made an asp page that pulls data from the database and then creates some checkboxes. I then add it to the inside of a table like so:

    Code:
    	<%while not fieldNames.EOF%>
    	<tr>
    		<td><font size="1"><b><%=Trim(fieldNames.Fields.Item("FieldName").Value)%></b></font></td>
    		<td>
    			<center><input name="<%=Trim(fieldNames.Fields.Item("FieldName").Value)%>" type="checkbox" /></center>
    		</td>
    	</tr>
    	<% fieldNames.MoveNext()
    	     Wend%>

    I then need to go back and check any checkboxes that have a fieldName present in another DB table.

    Currently I am trying to make the checkbox check but have been unable to here is the current code I am trying:

    Code:
    <%
    	Dim checkBox
    	If not userFields.EOF then
    		while not userFields.EOF
    			set checkBox = userFields.Fields.Item("FieldName")
                           'set checkbox = Request.Form(userFields.Fields.Item("FieldName"))
    	        checkBox.checked = True
    			userFields.MoveNext()
    		Wend
        End if
    %>

    No matter what I have tried I have not been able to check a simple checkbox..... PLEASE HELP!!!
    Last edited by classicNoob; Sep 17 '15, 08:45 PM. Reason: added another line of code to 2nd codebox.
Working...