ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 11th, 2004, 11:54 AM
EBP2K2 EBP2K2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 48 EBP2K2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Returning more than 1 variable from cffunction?

is this possible, I have a function that returns boolean value...
and I would like it to return error message along with the boolean value when an error is encountered...

thnx

Reply With Quote
  #2  
Old September 12th, 2004, 12:01 AM
kaasu kaasu is offline
Web Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 58 kaasu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 4 sec
Reputation Power: 5
You can return a complex variable instead, like an array or structure or simply you can return a delimited list with first element as boolean and second as error like "false~There was an error"

Reply With Quote
  #3  
Old September 12th, 2004, 04:10 AM
EBP2K2 EBP2K2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 48 EBP2K2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
can you show me an example for returning a delimited list?

thnx

Reply With Quote
  #4  
Old September 12th, 2004, 10:31 AM
kaasu kaasu is offline
Web Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 58 kaasu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 4 sec
Reputation Power: 5
It would be simply returning

<cfreturn "false~your message" />

where "~" is the delimiter

Reply With Quote
  #5  
Old September 13th, 2004, 05:31 AM
EBP2K2 EBP2K2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 48 EBP2K2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
thnx...

I'm not sure anymore if this is what I want... can you help me figure out just what I need to do here? ----->

I have a checkout page, and when the person clicks a button, it will invoke cfc method that inserts into database information collected from the ckeckout process, and rolls back when appropriate... within that function it also POSTs to a transaction server for creditcard processing, and receives reponse, which will also determine whether the database transaction will roll back or commit...

my problem is displaying the response... since that function only returns boolean... I dunno how to pass that POST response outside the cfc to be displayed on the checkout page...

I can try doing cfhttp post ourside the cfc, but it will mean I cannot roll back the database if the creditcard process is declined or has error...

tried session, what you suggested, and few other things to no avail...

any ideas?

thnx...

Reply With Quote
  #6  
Old September 13th, 2004, 07:48 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,611 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 10 m 21 sec
Reputation Power: 53
What type is the post response? Is it an array, structure, Java object, etc. Doing a cfdump of the response should tell you what the type is. Then just set the return type of your CFC to that type (or to "any") and you can return it to the caller.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #7  
Old September 14th, 2004, 08:34 AM
EBP2K2 EBP2K2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 48 EBP2K2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
thnx to you guys, I figured it out!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Returning more than 1 variable from cffunction?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway