CFSWITCHCFCASECFDEFAULTCASE

I l @ ve RuBoard

< CFSWITCH >/<CFCASE>/<CFDEFAULTCASE>

Evaluates a passed expression and determines what <cfcase> matches that expression. The code within the matching <cfcase> tag is then executed. If there is no match, the code within the <cfdefaultcase> tag is executed.

Syntax

 <cfswitch expression="expression">    <cfcase value="value_to_match_expression" delimiters="delimiter_of_list">     Code to be executed   </cfcase>   <cfdefaultcase>     Code to be executed   </cfdefaultcase> </cfswitch> 

Attributes

Expression: Required. The values to be used to test against case values could be numbers , strings, or Boolean values.

Value: Required. The value that is compared to the expression. You can separate multiple values with commas or with another value specified in the delimiter attribute.

Delimiter: Optional. The character used to separate multiple values in the value attribute.

Example

 <!--- Output a different message based on a URL variable status --->  <cfswitch expression="#url.status#">   <cfcase value="notready">     You are not ready!   </cfcase>   <cfcase value="ready">     You are ready!   </cfcase>   <cfdefaultcase>     Your status is not known.   </cfdefaultcase> </cfswitch> 
I l @ ve RuBoard


Macromedia ColdFusion 5. Training from the Source
Macromedia ColdFusion 5 Training from the Source (With CD-ROM)
ISBN: 0201758474
EAN: 2147483647
Year: 2002
Pages: 99
Authors: Kevin Schmidt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net