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

CheckBox issue

Status
Not open for further replies.

TudorSmith

Programmer
Jan 14, 2002
245
GB
Right, firstly I have a field in my SQL Server2000 table called "Commit"

Now I want to retrieve all the record sin the tabel and display them in a TABLE on an ASP form. For each rst value in the row, is a column for the "Commit" value (currently varChar storing "Yes" or "No" - but let me know if there is a better way).

I would like to have a Check box in my column and if the Commit value=Yes, then have the CheckBox show a tick.

What I have is:

Code:
<%Dim rst
  Set rst = objConn.Execute("tblSales")

  Do Until rst.EOF
      IF rst("Commit") = "YES" THEN%>
          <INPUT TYPE="CheckBox" Value=1>
     <%ELSE%>
          <INPUT TYPE="CheckBox" Value=0>
     <%END IF
     rst.movenext 
  Loop
  rst.close%>

I've played around with different "VALUE" but I'm suspicious that I am actually not setting the Checkbox to be "Checked" but instead, and storing a vlaue as if the CheckBox is a variable!

Anyone got any smashing ideas? [glasses]





birklea ~©¿©~ <><
Dim objJedi as Jedi.Knight
Set objJedi[skyWalker].Aniken = FatherOf(useThe.Force(objJedi[skyWalker].luke))
 
checked gives the ticked value dynamically

like this
Code:
<%Dim rst
  Set rst = objConn.Execute("tblSales")

  Do Until rst.EOF
      IF rst("Commit") = "YES" THEN%>
          <INPUT TYPE="CheckBox" checked>
     <%ELSE%>
          <INPUT TYPE="CheckBox">
     <%END IF
     rst.movenext 
  Loop
  rst.close%>



___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
also, the varchar field is fine, but if you want to set the table up to be a bit more space efficient, you can use a bit data type for something of this nature.

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top