Solved

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

Posted on 2006-11-12
2
234 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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now