Solved

Build list from check boxes

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

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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