This is wrong on multiple counts.

First, isDefined takes a string. Ie, you should do:

<cfif isDefined("variable")>
        #variable#
</cfif>

If youdo, isDefined(#variable#) you are saying, "If variable is foo,
tell me if I have a variable called foo." What you really want is "Tell
me if I have a variable called variable.



=======================================================================
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email    : [EMAIL PROTECTED]
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: trey [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, June 03, 2002 4:08 PM
> To: CF-Talk
> Subject: if value exists, show it
> 
> 
> I simply want to test to see if a variable has a value (eg 
> text has been 
> returned from a query) and if so, show it. There seem to be a 
> few options --
> 
> <cfif isdefined(#variable#)>
>       #variable#
> </cfif>
> 
> or
> 
> <cfif len(#variable#) GT 0>
>       #variable#
> </cfif>
> 
> or
> 
> <cfif #variable# IS "">
>       #variable#
> </cfif>
> 
> Is one of these better than the others for dealing with text 
> values? I 
> understand that IsDefined should be locked; I assume that is 
> not the case 
> for the other two.
> 
> TIA,
> Trey 
> 
> 
> 
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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