Solved

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

Posted on 2006-11-12
2
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
What You Need to Know when Searching for a Webhost Provider
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

630 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