3-1-Tags:CFElseIf
last edited by
lmajano
on 23-Aug-2009
cfelseif
Description
Used in a CFIF block to handle any matching conditionals that were not previously processed by any prior CFIF or CFELSEIF tags.
Category
Other
Implemented
Usage Syntax
<cfelseif [contition="Boolean"]/>
[] = Optional attribute
Attributes
| Name | Type | Required | Default | Description |
| contition | Boolean | No | Expression Contition |
Example Usage
Example:
In this example we will show how to vary the display results of a database query, which can be manipulated by using a very simple comparison expression in the CFIF tag.
<--- Fetch the list of countries ---> <cfquery name="getCountries" dbsource="regionalData"> SELECT country_ID, country_Name, country_Capital FROM countries ORDER BY country_Name </cfquery> <--- Display our results using different conditions ---> <p>By introducing the CFELSEIF tag we can introduce multiple conditions.</p> <ul id="listCntryAUZ"> <cfquery query="getCountries"> <cfif Left(getCountries.country_Name, 1) IS 'A'> <li>#getCountries.country_Name#</li> <cfelseif Left(getCountries.country_Name, 1) IS 'U'> <li>#getCountries.country_Name#</li> <cfelseif Left(getCountries.country_Name, 1) IS 'Z'> <li>#getCountries.country_Name#</li> </cfif> </cfquery> </ul>
SideBar
User Login
Comments (