12 Replies Latest reply on Sep 18, 2006 7:30 PM by nyfeman

    Trouble with passing an object to a CFC

    nyfeman Level 1
      I'm trying to pass an object back to a cfc via RemoteObject and can't get a favorable resolution, please look this over and let me know if you see my error?

      The error I am getting seems to imply that either the object is not being sent or it's not arriving correctly. (How does ColdFusion receive an object? Should I be using some other type (struct, array, etc.)?)


      The object is a collection of name/value pairs and is defined.

      This is the ActionScript part:
      public var svcEvent:RemoteObject = new RemoteObject();
      public function useRemoteObject(eventTransfer:Object):void{
      svcEvent.destination ="ColdFusion";
      svcEvent.source = "EventComp";
      svcEvent.qryEventData.addEventListener("result", resultHandler);
      svcEvent.qryEventData.addEventListener("fault", faultHandler);

      This is the CFC:
      <cfcomponent name="EventComp">

      <cffunction name="qryEventData" access="remote" returnType="query">
      <cfargument name="eventTransfer" type="struct" required="yes"/>
      <cfparam name="eventTransfer" type="any" default="not_passed"/>

      <cfif eventTransfer is not "not_passed">
      <cfset eventName = eventTransfer.eventName>
      <cfset eventLocation = eventTransfer.eventLocation>
      <cfset contactName = eventTransfer.contactName>

      <cfquery datasource="Roster" name="newEvent" debug="yes">
      INSERT INTO tblEvents
      (eventName, eventLocation, contactName)
      VALUES (#eventName#, #eventLocation#, #contactName#)
      <cfquery datasource="Roster" name="event" debug="yes">
      SELECT * FROM tblEvents
      // this if statement is just so I can tell if the parameter is really passed or not.
      <cfif eventTransfer is "not_passed">
      <cfquery datasource="Roster" name="event" debug="yes">
      SELECT * FROM tblEvents WHERE eventName = "NSCW"
      <cfreturn event>