How to use cfcase in cfswitch in ColdFusion

cfcase in cfswitch

cfcase.cfm


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcase tag example: how to use cfcase tag in cfswitch tag</title>
</head>

<body>
<h2 style="color:Crimson">cfcase Tag Example</h2>


<cfset Color="DarkBlue">
<cfoutput>
<b>Your Color:</b> #Color#
<br />
</cfoutput>

<cfswitch expression="#Color#">
 <cfcase value="Crimson">
  You choose color: Crimson[#DC143C]
    </cfcase>
 <cfcase value="DarkBlue">
  You choose color: DarkBlue[#00008B]
    </cfcase>
 <cfcase value="DarkRed">
  You choose color: DarkRed[#8B0000]
    </cfcase>
 <cfcase value="Lime">
  You choose color: Lime[#00FF00]
    </cfcase>
    <cfdefaultcase>
  You choose unknown color
    </cfdefaultcase>
</cfswitch>

</body>
</html>





More coldfusion examples