|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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"
|
|
#3
|
|||
|
|||
|
can you show me an example for returning a delimited list?
thnx |
|
#4
|
|||
|
|||
|
It would be simply returning
<cfreturn "false~your message" /> where "~" is the delimiter |
|
#5
|
|||
|
|||
|
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... |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
thnx to you guys, I figured it out!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Returning more than 1 variable from cffunction? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|