<CFSWITCH> Tag - ColdFusion
>> Return to CF Tag List
The <CFSWITCH> tag allows you ...
<CFSWITCH> Comments from Macromedia LiveDocs
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-c10.htm
switch thinks "00" and "0A" are both "0.0"....
function Hex7toStr(Char){
switch (Char)
{
case "00":
newchar = "NUL";
break;
case "0A":
newchar = "LF";
break;
}
return newchar;
}
Is this expected behaviour?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-c10.htm
Switch and Case take strings the documentation should explicitely say whether these tags are case-sensitive.
Also, the doc says that the expression should evaulate to a scalar. Is a string normally considered a scalar value?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-c10.htm
Your example doesn't throw an error, but there's no CFML code outside of the CFCASE tags. If you were to alter your code as in the following example, you would see that ColdFusion throws an error when it encounters the CFOUTPUT.
<CFSET x=1>
<CFSWITCH EXPRESSION="#x#">
<CFCASE VALUE="0">test1</CFCASE>
<CFOUTPUT>The value of x is #x#.</CFOUTPUT>
<CFCASE VALUE="2">test2</CFCASE>
not in case 2
</CFSWITCH>
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-c10.htm
This page states:
"All code within this tag must be within a cfcase or cfdefaultcase tag. Otherwise, ColdFusion throws an error."
This statement is not true (at least in CF MX 6.1), the following code runs just fine:
<CFSET x=1>
<CFSWITCH EXPRESSION="#x#">
<CFCASE VALUE="0">test1</CFCASE>
not in case 1
<CFCASE VALUE="2">test2</CFCASE>
not in case 2
</CFSWITCH>
[Top]
Recommended Books
COLDFUSION MX Web Application Construction Kit (5th Edition)
Authors: Ben Forta and Nate Weiss
1500 pages
[Top]
Web Sites
Macromedia
The makers of ColdFusion/ColdFusion MX.
ColdFusion Developer's Journal
Forta.com (ColdFusion Section)
Ben Forta is Macromedia's Senior Technical Evangelist. Here on his site find useful ColdFusion information.
Flash CFM
Flash and ColdFusion Development.
Handling file uploads without CFFILE
BLOG post by "Sam" on REWINDLIFE.COM gives insight into how to upload a file on your site if you are not allowed to use the CFFILE tag.
[Top]
Copyright © 2003- 2010, Orville Paul Chomer, All Rights Reserved
Home Page
Blog
How To
Chomer TV
The Show
Webcam Videos
Freeware
•
VB Mahjongg
Coding
•
ColdFusion
•
Javascript
•
Visual Basic
Other Places
Acoustic Eidolon
History Singers
Scobleizer
Beach Walks
Freshtopia
CSS Zen Garden