[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • Last Modified:

How do you return a value in a checkbox?

I've got a series of Yes/No  fields and I want to allow the user to see which ones are checked. I've tried a couple things and I've decided to ask the experts. Here's what I've got:

set RSList = conn.execute("select * from inv order by make")

When I get to my checkboxes how do I reflect the "True" value?

<input type="checkbox" name="Powersteering" value="<% response.write RSList("PowerSteering") %>">

There's no error on the page, but no check mark either.

What do you think?
0
brucegust
Asked:
brucegust
1 Solution
 
PerfunctionCommented:
I think this is what you need:

http://www.apycom.com/drop-down-menu/ex11.html
0
 
brucegustPHP DeveloperAuthor Commented:
No...

I'm not looking for the user to manually check the box. I need VBScript to look at the database and insert a checkmark into the checkbox where the status is "True".
0
 
hesCommented:
Use checked=True not value=

<input type="checkbox" name="Powersteering" checked="<% response.write RSList("PowerSteering") %>">
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
brucegustPHP DeveloperAuthor Commented:
hes

We're on the threshold of greatness, my friend, but I'm still missing something.

When I introduced your code:

<input type="checkbox" name="Powersteering" checked="<% response.write RSList("PowerSteering") %>">


Every auto was displayed as having power steering which isn't the case. In other words, not every car has Power Steering, yet every Power Steering box is checked.

What...?
0
 
jwbeckCommented:
I don't know if this is the most efficient way of doing it, but what I will typically do is write out one of two lines of HTML for the corresponding Checkbox element like this:

<input type="checkbox" name="Powersteering" <%If RSList("PowerSteering") = True Then Response.Write "CHECKED">

Doing it this way should at least display the checkboxes on the screen poperly. Saving the data back to the database would have to be handled separately.

Hope this helps.

0
 
jwbeckCommented:
Syntax correction:

<input type="checkbox" name="Powersteering" <%If RSList("PowerSteering") = True Then Response.Write "CHECKED"%>>
0
 
brucegustPHP DeveloperAuthor Commented:
That got it!

Thanks!
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now