Problem with Checkboxes displaying information.

B

Brave

I am working on a database that has many Yes\No fields in thet table.
It is located on an SQL server, and I am using Frontpage to connect to
it. Output will be in ASP.

When the entry form is filled out, it uses checkboxes for input. I was
asked to create ASP pages to display the data, and they want to use
checkboxes in the output. In other words, they want the check boxes to
be checked if the answer is yes, and blank if the answer is no.

The data is listed in the database as 0, and -1. The ASP page reads the
entries as True and False. Although the data value is listed in the ASP
code correctly (as True or False), the checkbox never registers a
check. It always stays blank.

Is there anyway to get the checkbox to understand that True means
checked and False means blank? If I use Input="Text" it presents the
data correctly (as True or False) in a text field, but Input="Checkbox"
does nothing.

Thanks for any help you can give.
 
D

David Berry

There are a couple ways to do this. For example:

strFieldName = objRS("FieldName") ' this is the field that has the value for
the checkbox

if ucase(trim(strFieldName)) = "TRUE" then
strFieldName = "CHECKED"
else
strFieldName = ""
end if


<input type="checkbox" <%=strFieldName%> name="FieldName" value="ON">
 
B

Brave

Thank you for your help. I will try this today.

There are a couple ways to do this. For example:

strFieldName = objRS("FieldName") ' this is the field that has the value for
the checkbox

if ucase(trim(strFieldName)) = "TRUE" then
strFieldName = "CHECKED"
else
strFieldName = ""
end if

<input type="checkbox" <%=strFieldName%> name="FieldName" value="ON">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top