Yes, you must check that the checkbox is defined. Unchecked checkboxes
essentially do not exist when passed.

<CFIF IsDefined('Form.CheckBox')>I want banner ads.</CFIF>

The value doesn't matter. Unless you have multiple checkboxes with the
same name. For example:

<INPUT TYPE="checkbox" NAME="BannerAds" VALUE="Porn"> Porn
<INPUT TYPE="checkbox" NAME="BannerAds" VALUE="Affiliate"> Affiliate
<INPUT TYPE="checkbox" NAME="BannerAds" VALUE="Visa"> Visa
<INPUT TYPE="checkbox" NAME="BannerAds" VALUE="Free"> Free

Any checked boxes will result in a comma separated list being passed for
BannerAds. So if the first and last boxes were checked, BannerAds would
equal "Porn,Free">.

> I think you'll need to check that it's defined (IsDefined("checkbox"))
> first... otherwise the if test will fail if it hasn't been checked.
> 
> I may be wrong though!!  :^)
> 
> 
> > From: "Kevin Mansel" <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > Date: Tue, 13 Feb 2001 22:48:32 -0800
> > To: CF-Talk <[EMAIL PROTECTED]>
> > Subject: Re: Check value of form check box for CFMAIL
> > 
> > Jeff,
> > 
> > If you want to test if it has been checked you can do it this way...
> > 
> > <input type=checkbox value="bannerad" name="checkbox">
> > 
> > <cfif #FORM.checkbox# IS "bannerad">
> > I want banner ads
> > </cfif>
> > 
> > Kevin Mansel
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to