From: cyber fyb on
Do I am the only one on Earth who need to return a string instead of a numeric
value when using a CFDIV-BIND on a CFC? My god! this is hard to find anybody
who went to the same thing! Or I am missing something about the real utilitity
we suppose to do with a CFDIV or somebody will have to explain to me! Sorry,
this comment is after having passed many hours (thinking I will find my answer
fast).

Alright, here is what I need to do. I am trying to create a chat using the new
features of CF8. I am very close to achieve the first step of my project. So
let say that you have the big board where text will appear as users will type
their messages and than a little text field at the bottom where the user will
type is message.

I want to prove a point I am reading since long time now about the Ajax and
CF8 has just reinforce it when starting to explain that we can have automated
update if we are calling our functions with asynchronous methods. This what I
want to do and I am trying to use a CFDIV to that where I am passing the CFC
command in the BIND. the system is always returning me that the "return" cannot
be converted as numeric. Well, my return is in fact a table of all the messages
in the database - formatted to display the time, the user and the message or
each record.

I can see I am not using the technology correctly at this moment but if
anybody know anything that can redirect me to a good explication (my brain need
to understand why now as it is not logic at the moment - why I cannot push in
the CFDIV whatever I want?).

You will find some code for whom will better understand like that!:confused;

INDEX.cfm

[...]
<cflayoutarea position="center">
<cfdiv id="messageInterface"
bind="url:chatFunctions.cfc?method=readMessage&roomId=1&returnformat=plain"
bindonload="true"/>
</cflayoutarea>

[...]

chatFunctions.cfc

<cffunction name="readMessage" access="remote" output="false" returntype="ANY"
returnformat="JSON">
<cfargument name="roomID" required="true" type="numeric" default="1">
<cfset result = "">
<cfquery name="qGetMessage" datasource="#THIS.DNS#">
SELECT *
FROM chatDiscussion
WHERE chatRoomID = <cfqueryparam value="#ARGUMENTS.roomID#"
cfsqltype="cf_sql_integer">
ORDER BY dtDiscussion
</cfquery>
<cfif qGetMessage.RecordCount GT 0>
<cfset result = "<table width='100%' cellspacing='0' cellpadding='0'>">
<cfloop index="cptMessage" from="1" to="#qGetMessage.RecordCount#">
<cfset result = result & "<tr>">
<cfset result = result & "<td align='left' valign='top'>" &
timeFormat(qGetMessage.dtDiscussion[cptMessage], "HH:mm:ss") & "</td>">
<cfset result = result & "<td align='left' valign='top' width='20'><img
src='avatars/cyberfyb.jpg' alt='" & session.nickName & "' border='0'></td>">
<cfset result = result & "<td width'2'>&nbsp;</td>">
<cfset result = result & "<td align='left' valign='top'>" & session.nickName &
"</td>">
<cfset result = result & "<td width'2'>&nbsp;</td>">
<cfset result = result & "<td align='left' valign='top'>" &
qGetMessage.txtDiscussion[cptMessage] & "</td>">
<cfset result = result & "</tr>">
</cfloop>
<cfset result = result & "</table>">
</cfif>
<cfset result = result + "<br><font color='red'>Allo-cf</font>">
<cfmail to="fybourassa(a)icongo.com" from="vts(a)icongo.com" subject="debug"
type="html">
result = <br><br>
#result#
</cfmail>
<cfreturn result>
</cffunction>

From: cyber fyb on
Oups! It mights be not the fault of the CFDIV! sorry about my reaction. after I
wrote my previous thread, I decided to test another way and to create a page
where the BIND will go directly to that page (url:readMessages.cfm) is
demonstrating that I can put whatever I want in that CF-DIV! But, when invoking
again the CFC function, I've got the same error (from that new page).

So it is something about transfering the data.

From: cyber fyb on
Never mind! As some of you will probably notice, I used at some point the
result = result + insteal of & and that was my error!

Maybe the day should end now when I got error like this and expose myself as
this!!!

;-))