> 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.

But that's not how isDefined works. If you pass isDefined a string
literal, it tests to see if there is a variable whose name matches the
string literal. So, this will work:

isDefined("thisVariableDoesNotExist")

and (assuming the variable doesn't exist) it will return false. But,
if you did this:

isDefined(thisVariableDoesNotExist)

it would first evaluate the expression thisVariableDoesNotExist, and
that would cause an error (again, assuming the variable doesn't
exist).

In the posted code sample, there are single quotes around someValue,
making it a string literal.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:333288
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to