Click to See Complete Forum and Search --> : Checkbox checked using recordset


Squall Leonhart
11-18-2003, 02:07 PM
Hi, guys.
Nice to see you again.:)

Please have a look at this code


<input name="checkbox1" type="checkbox" checked value="<%=rsEdit.fields("Status")%>">


This code is supposed to show checked checkbox if the value of recordset rsEdit.fields("Status") is "true". And unchecked otherwise.
How can I solve this?:(

gil davis
11-18-2003, 02:11 PM
<input name="checkbox1" type="checkbox"<%if rsEdit.fields("Status") = "true" then Response.write " checked" end if%>>

assuming that the status field really contains a string.

Squall Leonhart
11-18-2003, 02:18 PM
Ah, I forgot to mention that status field is checkbox field as well
Data type is yes/no.

gil davis
11-18-2003, 02:46 PM
A yes/no box is an object that contains true or false:
<input name="checkbox1" type="checkbox"<%if rsEdit.fields("Status") = true then Response.write " checked" end if%>>

Squall Leonhart
11-18-2003, 04:13 PM
:) Thank you very much. Works great.