Solved

Build list from check boxes

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now