I believe the trouble to be this:
<cfqueryparam value="#someValue#" null="#not IsDefined('someValue')#" />
Works fine when the value is defined. However, if the value is not defined,
value="#someValue#" will throw an error - ColdFusion evaluating it
before/regardless of the value of the null attribute.
Personally, I find cfparam tidier than checking existence of variables
throughout a script. Variables can all be defaulted at the top of the script
with a single clear line per variable. Not always appropriate of course, but
still - just my preference.
Upshot, if you want a tidy cfqueryparam, you will need to guarantee the
existance of 'someValue' and then do something like:
<cfqueryparam value="#someValue#" null="#not Len(Trim(someValue))#" />
HTH
Dominic
On 30 April 2010 23:00, Ian Skinner <[email protected]> wrote:
>
> You can either use the <cfparam...> tag to make sure they are never
> undefiend, or you can use the structKeyExists() or the less prefered
> isDefined() functions to test if they exist.
>
> For the latter options you may need to write a more complex expression
> for the null property that makes uses of some type of AND|OR operators.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333285
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm