Thanks, Scott.

Now I see the distinction...and that worked!

Rick


-----Original Message-----
From: Scott Brady [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 27, 2002 12:16 PM
To: CF-Talk
Subject: Re: Best way to handle Checkboxes with Insert Query?


>I've read on this list that it's recommended to use #IsDefined()# in place
>of #ParameterExists()#,
>but doesn't IsDefined assume the existence of the variable, and therefore
>doesn't check
>for the existence as does ParameterExists?  CFPARAM? And why has
>ParameterExists become deprecated
>as a function anyway?

IsDefined essentially does the same thing as ParameterExists, except you can
use dynamic values in IsDefined (and I believe you couldn't in PE), so you
could do: IsDefined("variables." & variableName), which I believe you
couldn't do with PE.  That, and you use quotation marks . . . .

Now, on to your real question:

>So...with that in mind, what's the best way to handle an Insert Query where
>checkboxes
>may or may not be checked on a form?

At some point before that query (generally at the top of the page), put a
cfparam for that chekbox defaulting it to a false value (or anything other
than the value of the checkbox when it's checked):

<cfparam name="FORM.mycheckbox" default="False" type="Boolean">

Then, in your insert query, you can just check to see if the checkbox is
False or not and adjust your query accordingly. (if it's a yes/no type
field, I believe you can just insert the value of the checkbox).

Hope that helps.

Scott
--------------------------------
Scott Brady
http://www.scottbrady.net/



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to