The value is held in the value= portion of the cfinput tag and can be
referenced after a submit as form.name where name is the name= portion of
the cfinput tag.

<cfinput checked=#chk# type="Checkbox" NAME="location"
VALUE=#intLocationID#> #strLocationName#, #strStateAbvrIDFK#

If you have several dynamically generated checkboxes (which sounds more like
what you were asking) and you want a quick check you can do the following.

May be more useful on a validation page
<cfif listLen(location) eq 0>
code here (i.e. tell the user they must check at least one check box)
<cfelse>
other code (process the boxes that were checked)
</cfif>

or you can use this (more likely on a processing page)

<cfif #IsDefined("form.location")#>
<cfloop index="LName" list=#form.location#>
        processing code here
</cfloop>
</cfif>

You could set the value initially to "no" with a cfparam then if the
checkbox gets checked, the value will get changed to the value in the
cfinput tag but given the above examples, this seems like a waste of time.

Not sure exactly what you're looking for, if none of the responses you've
gotten so far have helped, rephrase your question and give an example / some
code. If you get your answer, post a thanks so people won't keep trying to
answer. An example / code may lead to other options like radio buttons etc.

HTH

Stephen

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 9:19 AM
To: CF-Talk
Subject: RE: Validating Checkboxes


I always use ifDefined("form.checkbox") to see if the box was checked.
Using CFParam seems (very slightly) more error prone to me.

Brian

-----Original Message-----
From: Roque,Carlos [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 22, 2001 5:45 PM
To: CF-Talk
Subject: RE: Validating Checkboxes


I am trying to pass a value if when a box is selected. Right now I use a
CFPARAM default ="". On submit it looks like it does something even though
it really does not.

Carlos Roque
I.S., WebMaster
x2154

 -----Original Message-----
From:   Phoeun Pha [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, February 21, 2001 11:07 AM
To:     CF-Talk
Subject:        RE: Validating Checkboxes

what kind of validation?  please explain

-----Original Message-----
From: Roque,Carlos [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 21, 2001 10:18 AM
To: CF-Talk
Subject: Validating Checkboxes


Anyone have a good method in CF for validating checkboxes (grouped).


Carlos Roque
I.S., WebMaster
x2154
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to