[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How do you return a value in a checkbox?

Posted on 2004-10-21
7
Medium Priority
?
285 Views
Last Modified: 2010-04-17
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
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 1

Expert Comment

by:Perfunction
ID: 12372426
I think this is what you need:

http://www.apycom.com/drop-down-menu/ex11.html
0
 

Author Comment

by:brucegust
ID: 12372502
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
 
LVL 20

Expert Comment

by:hes
ID: 12372592
Use checked=True not value=

<input type="checkbox" name="Powersteering" checked="<% response.write RSList("PowerSteering") %>">
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:brucegust
ID: 12372716
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
 

Expert Comment

by:jwbeck
ID: 12372951
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
 

Accepted Solution

by:
jwbeck earned 100 total points
ID: 12373002
Syntax correction:

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

Author Comment

by:brucegust
ID: 12373414
That got it!

Thanks!
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Starting up a Project

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question