[thelist] [CF] Value of a url var with no value

Raymond Camden jedimaster at macromedia.com
Mon Jul 30 12:42:12 CDT 2001


> What I don't understand is, even if there is no concept of null, why this
> doesn't match:
>
> <cfcase value=",0" delimiters=",">
> 	<!--- do stuff --->
> </cfcase>
>
> Is this not the same as:
>
> <cfcase value="">
> 	<!--- do stuff --->
> </cfcase>
>
> <cfcase value="0">
> 	<!--- do stuff --->
> </cfcase>
>
> ?

The reason is that when you use value="...,..." it's treating the value as a
list. In ColdFusion, having an empty element in a list is not the same as a
null in the list, CF simply ignores it. To see this better, try
ListLen(",2") and the value will be 1.

Since you say you have some complex logic above, I'd consider doing:

<CFIF NOT Len(Trim(URL.Foo))>
	<CFSET URL.Foo = "">
</CFIF>

Oh wait, I'm sorry, you say you can't change the value. Well, if that's so,
then simply don't use CFSWITCH, use CFIF instead.

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email   : jedimaster at macromedia.com
ICQ UIN : 3679482

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






More information about the thelist mailing list