Solved

Build list from check boxes

Posted on 2014-03-17
3
190 Views
1 Endorsement
Last Modified: 2014-04-04
I am outputting a list of checkboxes and their values using the code below. When the user hits submit, I'd like to add the value of each checkbox to a list. Could someone assist with this? I'm not sure how to collect the checkboxes that were selected and add them to a ColdFusion list.

Thank you!

<cfquery name="getcars" ...>

				Select distinct CarName
				from tblCars
</cfquery>

  <cfoutput query="getcars">
            
        <td>#CarName#</td>
        <td>
            <input type="checkbox" name="CarName" value="#CarName#">  <br>
        </td>
        
    </cfoutput>

Open in new window

1
Comment
Question by:earwig75
[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
3 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 39935467
easy, it is done for you.

The variable FORM.CarName   will be a comma delimited list of all checked values after the form is submitted

Its automatic
0
 
LVL 4

Expert Comment

by:Rodrigo Munera
ID: 39935929
One thing to take into account, if the user doesn't check any boxes, form.carname will not exist in the action page, so make sure you use cfparam on the action page so you don't run into syntax exceptions.
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 39977937
provide the client side validation just to make sure at least one checkbox is checked
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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