I ran into this just yesterday.

The issue seems to be that since this is a CF function and not a tag it
processes it inside out.  Not the same as a CFIF where it will skip
elements of the if statement should it be false.

The IIF prepares the two DE arguments before it evaluates it's
conditional statement.  So undefined variables end up throwing errors
still even if they should be skipped.  I ended up needing to use the
CFIF.

The CFIF processes faster anyways, but I still try to avoid it when I
want to do a conditional statement inside the attributes of an HTML tag
to keep the code clean.

Cheers,

t

-----Original Message-----
From: Jason Green [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 31, 2001 1:20 PM
To: CF-Talk
Subject: IIF() HELP!!!


why is it when you use IIF() and you are checking to see if a variable 
exists, the process will error out?  here is an example:

#IIF(IsDefined("FORM.classCodeID"), DE(FORM.classCodeID), DE("ALL"))#

if FORM.classCodeID exists, the code works fine.  but if
FORM.classCodeID 
doesn't exist, it errors saying it can't find FORM.classCodeID.
shouldn't 
it run the second DE() statement?  am i just not understanding the whole

IIF() tag?  has anyone else run into this and is there anyway of making
it 
work without using <CFIF> tags?

jason



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to