When performing a CFIF testing multiple conditions, be careful when testing
against a value that could equate to a Boolean true or false (0 or 1, yes or
no, etc.). For instance, if you wanted to test whether a form variable called
"answer" was either 1 or 0, how would you code the IF test? If you tested the
condition:
CFIF FORM.ANSWER IS 0 OR 1
the CF interpreter would not complain. Technically, that's a valid condition.
The problem is that it will always be true, regardless of the value of
FORM.ANSWER. This is because the interpreter is really being asked to
consider whether "FORM.ANSWER IS 0" is true or "1" is true. That's almost
certainly not what's intended by someone writing this condition, but since
the string "1" alone always equates to "true", the condition (since it's an
OR test) is always true.
The correct form of this condition should be:
CFIF FORM.ANSW... (more)
There are many excellent conferences and user groups for CFML developers, and
one that consistently gets great reviews is Michael Smith's CFUN event, which
will be held in the Washington, DC, area June 26-27. This preview gives you
the 4-1-1 on the event.
CFUN is the national ColdFusion and Web programming conference that
Rockville, MD-based IT firm TeraTech (www.teratech.com) hosts each June in
the DC area. CFUN stands for ColdFusion User Network and, based on my
experiences at CFUNs I have attended (and spoken at) in past years, there's
plenty of opportunity for users to learn... (more)
Have you ever wanted to test if a given array element exists? Or when dealing
with arrays of structures, if a given key exists?
Both are challenging if you try to use IsDefined(). This article addresses
why IsDefined() fails in both cases when working with arrays.
Part 1: Testing for Existence with an Array
The first problem arises in the following example: you have an array with
four items, but the two in the middle don't have any value (not an empty
string, but no array elements at two of the array positions). Consider the
following code:
more)
Did you know that in Studio you can place the cursor on a tag and press F1,
to view the help file for that tag? This would be the same help shown in the
help window, but you need not drill down to find the reference. And in 4.01,
this functionality has been extended to support CF tags and functions.
Charlie Arehart Education Director, Fig Leaf Software
... (more)
Where do you stand in the march of CF developers moving toward implementing
Flash interfaces in your Web apps? Are you gung ho? Still on the fence? Dead
set against it? Feeling left out? Left behind?
In this month's Journeyman ColdFusion column, I'd like to take up the cause
of Flash for CFers. In particular, if you're a developer who's been feeling
left out or left behind, or simply challenged to understand most articles and
books on the subject, take heart. In this article, I will share some
observations and insights to help get you on the right path.
As I say in my user group ... (more)