Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-12
2
Medium Priority
?
244 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 500 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

916 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