2 Replies Latest reply on May 22, 2008 11:43 PM by Philhurrell

    SCRIPT tag in application.cfm causes bind to fail!

    Philhurrell

      I have two cfselect boxes one bound to the other via a cfc.
      However if I include some javascript into application.cfm the bind stops working ?

      Anyone have any ideas?

      Code :
      art.cfc
      ==============
      <cfcomponent output="false">

      <cfset THIS.dsn="cfartgallery">

      <!--- Get array of media types --->
      <cffunction name="getMedia" access="remote" returnType="array">
      <!--- Define variables --->
      <cfset var data="">
      <cfset var result=ArrayNew(2)>
      <cfset var i=0>

      <!--- Get data --->
      <cfquery name="data" datasource="#THIS.dsn#">
      SELECT mediaid, mediatype
      FROM media
      ORDER BY mediatype
      </cfquery>

      <!--- Convert results to array --->
      <cfloop index="i" from="1" to="#data.RecordCount#">
      <cfset result [1]=data.mediaid>
      <cfset result [2]=data.mediatype>
      </cfloop>

      <!--- And return it --->
      <cfreturn result>
      </cffunction>

      <!--- Get art by media type --->
      <cffunction name="getArt" access="remote" returnType="array">
      <cfargument name="mediaid" type="numeric" required="true">

      <!--- Define variables --->
      <cfset var data="">
      <cfset var result=ArrayNew(2)>
      <cfset var i=0>

      <!--- Get data --->
      <cfquery name="data" datasource="#THIS.dsn#">
      SELECT artid, artname
      FROM art
      WHERE mediaid = #ARGUMENTS.mediaid#
      ORDER BY artname
      </cfquery>

      <!--- Convert results to array --->
      <cfloop index="i" from="1" to="#data.RecordCount#">
      <cfset result [1]=data.artid>
      <cfset result [2]=data.artname>
      </cfloop>

      <!--- And return it --->
      <cfreturn result>
      </cffunction>

      </cfcomponent>

      =============
      testme.cfm
      =============
      <cfform>
      <BR><BR><BR>
      <table>
      <tr>
      <td>Select Media Type:</td>
      <td><cfselect name="mediaid"
      bind="cfc:art.getMedia()"
      bindonload="true" /></td>
      </tr>
      <tr>
      <td>Select Art:</td>
      <td><cfselect name="artid"
      bind="cfc:art.getArt({mediaid})" /></td>
      </tr>
      </table>

      </cfform>

      ===========
      application.cfm (WORKING)
      ===========
      <CFAPPLICATION name="CREQ_DEV"
      clientstorage="Registry"
      clientmanagement="Yes"
      setclientcookies="Yes"
      sessionmanagement="Yes"
      sessiontimeout="#createtimespan(0,6,0,0)#"
      applicationtimeout="#createtimespan(0,6,0,0)#"

      loginstorage="session"
      >





      Application.cfm (BIND STOPS WORKING WORK)
      ===========
      <CFAPPLICATION name="CREQ_DEV"
      clientstorage="Registry"
      clientmanagement="Yes"
      setclientcookies="Yes"
      sessionmanagement="Yes"
      sessiontimeout="#createtimespan(0,6,0,0)#"
      applicationtimeout="#createtimespan(0,6,0,0)#"

      loginstorage="session"
      >
      <script type="text/javascript">
      function selectAll(list)
      {
      for (i=0; i<list.length; i++) {
      list.options .selected = true;
      }
      }
      </script>

      =======================