Solved

<cfswitch> not working when evaluating a variable returned from a custom tag

Posted on 2006-11-12
2
239 Views
Last Modified: 2013-12-24
I have a custom tag that returns caller.status after a call to that I have a cfswitch statement. NO matter what, the default case is run. I even output #status# in the defaultcase and it will show "OPEN" if that is what the customtag returns, why is the <cfcase value="OPEN"> not running when status = OPEN

The custom tag variable creation looks like: <cfset caller.status = CheckStatus[#attributes.status_col#][1]>

If I use <cfoutput>#status#</cfoutput> right above the cfswtich, it outputs the right value ie. OPEN

The code looks like..

<cfmodule template="mycustomtag">

<cfoutput>##</cfoutput> (this will display OPEN on the screen, but the default case is returned and still shows the status variable a OPEN!)

 <cfswitch expression="#status#">
 
 <cfcase value="OPEN">
 <p><strong>You are currently in a #status# status.</strong></p>
  </cfform>
 
 </cfcase>
 
 <cfcase value="PENDING">
 <p><strong>You are currently in a #status# status.</strong></p>
 </cfcase>
 
 <cfcase value="CONFIRMED">
 <p><strong>You are currently in a #status# status.</strong></p>
 </cfcase>
 
 <cfdefaultcase>ERROR: Current Status unavailable <cfoutput>#status#</cfoutput></cfdefaultcase>
 
0
Comment
Question by:LindaBobzien
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 125 total points
ID: 17927579

 Any chance of a space padding the status variable?  

 <cfswitch expression="#trim(status)#">
0
 

Author Comment

by:LindaBobzien
ID: 17927909
That was it. Man, I was fussing over that for an hour. Thanks.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
OpenLDAP set password to expire 7 705
DNS, website, godaddy 6 90
Setting Up Local Lan Web Server 1 65
How code a 301 redirect for folder files -> 1 file 2 58
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question