By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Classic ASP how to check a checkbox

P: 1
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:

Expand|Select|Wrap|Line Numbers
  1.     <%while not fieldNames.EOF%>
  2.     <tr>
  3.         <td><font size="1"><b><%=Trim(fieldNames.Fields.Item("FieldName").Value)%></b></font></td>
  4.         <td>
  5.             <center><input name="<%=Trim(fieldNames.Fields.Item("FieldName").Value)%>" type="checkbox" /></center>
  6.         </td>
  7.     </tr>
  8.     <% fieldNames.MoveNext()
  9.          Wend%>
  10.  

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:

Expand|Select|Wrap|Line Numbers
  1. <%
  2.     Dim checkBox
  3.     If not userFields.EOF then
  4.         while not userFields.EOF
  5.             set checkBox = userFields.Fields.Item("FieldName")
  6.                        'set checkbox = Request.Form(userFields.Fields.Item("FieldName"))
  7.             checkBox.checked = True
  8.             userFields.MoveNext()
  9.         Wend
  10.     End if
  11. %>
  12.  

No matter what I have tried I have not been able to check a simple checkbox..... PLEASE HELP!!!
Sep 17 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.