0 Replies Latest reply on Dec 20, 2006 3:11 PM by GeorgeWS

    ComboBox to CFC

    GeorgeWS Level 1
      I have a ComboBox that gets filled with a RemoteObject. That part works! I want to make a selection and that data go to a CFC that will populate a datagrid.

      This is the RO that fills the ComboBox:

      <mx:RemoteObject
      id="Region"
      destination="ColdFusion"
      source="youngsmarket.programs.RACDep.racdep.bin.racdep"
      showBusyCursor="true" >
      <mx:method name="Region" result="doPrompt2( event )">
      <mx:arguments>
      <supplierid>{SupplierID}</supplierid>
      <brandid>{BrandID}</brandid>
      <supcomp>{SupComp}</supcomp>
      </mx:arguments>
      </mx:method>
      </mx:RemoteObject>

      This is the ComboBox:

      <mx:ComboBox id="regionfilter" dataProvider="{newregion}" labelField="label" width="120" change="{RAC2.RAC2(regionfilter.selectedItem.data)}" enabled="true" />

      This is the FUNCTION:

      public function doPrompt2( event:ResultEvent ):void {
      newregion = Region.Region.lastResult;
      var prompt:Object = new Object();
      prompt.data = myRegion;
      prompt.label = "Select Region";
      newregion.addItemAt( prompt, 0 );
      }

      This is the RemoteObject I want the ComboBox to Call:

      <mx:RemoteObject
      id="RAC2"
      destination="ColdFusion"
      source="youngsmarket.programs.RACDep.racdep.bin.racdep"
      showBusyCursor="true" >
      <mx:method name="RAC2" result="handleQueryResult6(event)" fault="Alert.show(event.fault.message)">
      </mx:method>
      </mx:RemoteObject>

      This is the FUNCTION for 2nd RemoteObject:

      public function handleQueryResult6(event:ResultEvent):void{
      myData2=event.result as ArrayCollection;
      myRegion=regionfilter.selectedItem.data;
      }

      This is PART of my CFC:

      <cffunction name="RAC2" access="remote" returnType="query" output="false">
      <cfargument name="myregion" type="string" required="no">
      <CFQUERY DATASOURCE="COREDATA" NAME="RAC2">
      SELECT DISTINCT PCSTRC
      FROM WWW05WH, BLRACFDN
      WHERE PNUM5W = PCPNUM AND PCSTRC = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#myregion#" />
      </CFQUERY>
      <cfreturn RAC2>

      If I put a 71 or another known number in the #myregion# the application does what is supposed to do. except switch when the combobox is changed. I just dont know how to get the #myregion# to reflect what is chosen in the combobox. I did make a label in the app that shown me the number when the combobox is changed so I know the "regionfilter.selectedItem.data" is showing right. I just dont see how to send that along with the RemoteObject (RAC2) so it sends back the correct data.

      Thanks for looking any help would be great. I have been looking at this for a while.

      George