|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Instantiated CFC behaving incorrectly in IE7 & Safari, but works in Firefox
Author: Russ Shakespear
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:57067#309341
I've got a simple component that I'm instantiating to maintain a persistent
variable. Basically, the CFC checks for new entries in a table, and if there are
any, sets this variable to be the last entry's id. The next time the CFC is
called, it will check for new entries using this variable as the starting
point.This works perfectly in Firefox, but not IE or Safari. It appears as though
the variable is never set/stored, and remains at 0. I'm not sure what I'm
missing, but I can't find any documentation about why a CFC might behave
differently in different browsers. What am I missing???
I am instantiating the CFC into a session, using an init() method like so:
<cfset session.customerChat =
createObject("component","msg").init(chatSession.session)>
My CFC consists of two mehtods only:
<cffunction name="init" access="public" output="no" returntype="msg">
<cfargument name="sid" type="numeric" required="yes">
<cfset Variables.ssid = arguments.sid>
<cfset Variables.lastid = 0>
<cfreturn this>
</cffunction>
<cffunction name="getAllMessages" returntype="query" hint="gets all
messages in chat session">
<cfquery name="rsGetAllMsg" datasource="#variables.dsn#">
SELECT
cm.s_id,m_id,message,mtime,cm.o_id,cm.c_id,o_name,c_name,c_question
FROM chat_messages cm
LEFT OUTER JOIN chat_operators co
ON co.o_id = cm.o_id
LEFT OUTER JOIN chat_customers cc
ON cc.c_id = cm.c_id
WHERE cm.s_id = #Variables.ssid#
AND m_id > #Variables.lastid#
</cfquery>
<cfif rsGetAllMsg.recordcount neq 0>
<cfquery name="getlastid" dbtype="query">
SELECT max(m_id) as maxid
FROM rsGetAllMsg
</cfquery>
<cfset Variables.lastid = getlastid.maxid>
</cfif>
<cfreturn rsGetAllMsg>
</cffunction>
I would appreciate any help.
Thanks,
|
May 21, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||