Solved

Build list from check boxes

Posted on 2014-03-17
3
191 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

688 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