views:

43

answers:

1

I've noticed some strange browser specific weirdness with Google Chrome with some data bound buttons, in that when you navigate away from the page then use the browsers back button the data bind displays different data. If you then hit refresh it resets to the correct data. It doesn't happen in Firefox or Explorer 7.

I had actually entered the data bound bool button example to CF Cookbook http://cookbooks.adobe.com/post%5FUsing%5Fcfinput%5Fbuttons%5Fand%5Fdata%5Fbinding%5Fto%5Ftoggle%5Fd-16390.html so the files I'm using are there, direct link is http://cookbooks.adobe.com/index.cfm?event=getFile&fileId=6902 but now I have spotted this cross browser quirk I feel I should take it down unless of course you can help me figure out what is going on!

Any clues appreciated.

bool_buttons.cfm

<cfset url.messageID=28>
<CFSET application.dsn = "data">

<html>
<head>
    <title>Untitled</title>
</head>

<body>

<cfform>
<cfinput type="button" STYLE="width: 80px; height: 22px;" bind="cfc:messageProcess.togglebool('#application.dsn#', '#url.messageID#',{toggle1@click},'referral', 'Referral', 'Message')" name="toggle1" value="" bindonload="YES">
<cfinput type="button" STYLE="width: 80px; height: 22px;" bind="cfc:messageProcess.togglebool('#application.dsn#', '#url.messageID#',{toggle2@click},'viewed', 'Read', 'Unread')" name="toggle2" value="" bindonload="YES">
<cfinput type="button" STYLE="width: 80px; height: 22px;" bind="cfc:messageProcess.togglebool('#application.dsn#', '#url.messageID#',{toggle3@click},'actioned', 'Actioned', 'Pending')" name="toggle3" value="" bindonload="YES">
</cfform>
</body>
</html>

messageProcess.cfc

<cfcomponent>
    <cffunction access="remote" name="togglebool" output="true" returntype="any" displayname="Toggle boolean value in message record" hint="Toggles boolean value in message record">
     <cfargument required="true" name="dsn" type="string"/>
     <cfargument required="true" name="messageID" type="numeric"/>
     <cfargument required="true" name="buttonLabel" type="string"/>
     <cfargument required="true" name="switchName" type="string"/>
     <cfargument required="true" name="switchOnLabel" type="string"/>
     <cfargument required="true" name="switchOffLabel" type="string"/>
     <cfset var returnMessage = "" />
     <cfset var temp = "" />

     <cfquery datasource='#arguments.dsn#' name="getSwitchData">  
      SELECT #arguments.switchName#
      FROM messages
      WHERE messageID=<cfqueryparam value="#arguments.messageID#" cfsqltype="CF_SQL_INTEGER"/>
     </cfquery>

     <cfset temp="getswitchdata."&#switchName#>

     <cfif #Evaluate(temp)# is 1>
      <cfset returnMessage="#arguments.switchOnLabel#">
     <cfelse>
      <cfset returnMessage="#arguments.switchOffLabel#">
     </cfif>

      <cfif buttonLabel eq "">
       <cfreturn returnMessage>
      <cfelseif buttonLabel eq "#arguments.switchOffLabel#">
       <cfquery datasource='#arguments.dsn#'>  
       UPDATE messages
       SET #arguments.switchName#=1
       WHERE messageID=<cfqueryparam value="#arguments.messageID#" cfsqltype="CF_SQL_INTEGER"/>
       </cfquery>
       <cfreturn "#arguments.switchOnLabel#">
      <cfelseif buttonLabel eq "#arguments.switchOnLabel#">
       <cfquery datasource='#arguments.dsn#'>  
       UPDATE messages
       SET #arguments.switchName#=0
       WHERE messageID=<cfqueryparam value="#arguments.messageID#" cfsqltype="CF_SQL_INTEGER"/>
       </cfquery>
       <cfreturn "#arguments.switchOffLabel#">
      </cfif>
    </cffunction>
</cfcomponent>
+1  A: 

This is a Google Chrome bug, I had a similar case and opened a ticket here

Ast Derek