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

CheckBox Checked 1

Status
Not open for further replies.

PhatH

IS-IT--Management
Mar 30, 2004
88
US
Hello all,

I have a checkbox that's supposed to check if its value is 1 or blank if value is 0 (data was set in BIT in database), this is my code

<input type="checkbox" value=<% =rs("New") %> name="new" <% if (rs("New") = 1) then response.write ("Checked") %>>

It's not working, could someone point out the mistake(s) for me.

Thanks!
 
can you view the source of the outputted HTML and see if it indeed is writing out the checked?

from the way the code looks you may be getting this
<input type="checkbox" value= 1 name="new" Checked>
I don't think the space after the <% will cause a space but it may.


ALWAYS surround the attributes of any tag with quotes as you have done for name etc..

That _1 may be killing the rest of the tag



___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
I created this line: <% response.Write(rs("New")) %>

and got TRUE and FALSE for the outputs, but when I rewrite:
<input type="checkbox" value=<% =rs("New") %> <% if (rs("New") = "True") then response.write ("Checked") %>>

Still, nothing has changed.
 
try

<input type="checkbox" value="<%=rs("New")%>" <%If rs("New") then response.write("Checked")%>>

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Thank onpnt, that works great. But don't we need to specify whether rs("New") = "something" ???
 
no. simply stating If rs("New") checks to see if it is equal to True or False

Glad that did it!

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Well, thank you very much!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top