2 Replies Latest reply on Mar 26, 2008 8:24 AM by mark416

    How to pass Flex ArrayCollection to Coldfusion CFC?

    mark416 Level 1
      Hi,

      I try to pass flex ArrayCollection to coldfusion cfc as following

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical">
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;

      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;
      import mx.events.ValidationResultEvent;

      [Bindable]
      private var myAC:ArrayCollection = new ArrayCollection([
      {id:89, Contact: 'Bob Jones' },
      {id:5, Contact: 'Jane Smith' },
      {id:7, Contact: 'Doug Johnson' },
      {id:15, Contact: 'John Jackson'}
      ]);

      public function send():void {
      cfdata.sendData(myAC);
      }


      public function send_Result(event:ResultEvent):void {
      Alert.show('ok');
      }

      public function send_Fault(event:FaultEvent):void {
      Alert.show(event.fault.message);
      }



      ]]>
      </mx:Script>

      <mx:RemoteObject
      id="cfdata" showBusyCursor="true"
      destination="ColdFusion"
      source="debug.cfc.test">
      <mx:method name="send"
      result="send_Result(event)"
      fault="send_Fault(event)" />
      </mx:RemoteObject>

      <mx:DataGrid id="myGrid"
      dataProvider="{myAC}" editable="true" >
      <mx:columns>
      <mx:DataGridColumn dataField="id" width="150" editable="false"/>
      <mx:DataGridColumn dataField="Contact" width="150" />
      </mx:columns>
      </mx:DataGrid>
      <mx:Button label="Update DB" click="send()"/>

      </mx:Application>

      This is the cfc:

      <cfcomponent displayname="TestProcess" output="false" >

      <cffunction name="sendData" access="remote" output="false" returntype="true">
      <cfargument name="personQ" type="query" required="true" />

      <cfset process = true>
      <cfreturn process />
      </cffunction>
      </cfcomponent>

      I get following error message

      The argument pass to function is not the type query.

      Please let me know which data type I can use in cfc for the Flex ArrayCollection

      Thanks

      Mark