1 Reply Latest reply on Oct 12, 2007 6:31 AM by gmurnock

    Inserting Form Data and arrayCollection

    GeorgeWS Level 1
      I have this application:
      http://www.youngsmarket.com/youngsmarket/programs/national/nataccpro/bin/NatAccPro.cfm?Sup plierID=30

      you can view the source by right clicking

      So far the application works like this...
      A user selects a group from the drop down at the top. Then Checks a few Checkboxes in the Data grid. Towards the bottom are some form fields Comboboxs, textfields checkboxs datefields. The user fills in the bottom and then presses send.
      This all works great except. I canot figure out how to get the records from the datagrid to go to the CFC. When a user does all that I said here the form fields in the "Program" area get inserted just fine. I need the datagrid Cust and Seq that are chosen by the Include (datagrid checkbox), to get joined with the "Program" selections. I have a trace that shows that the checkbox items get chosen but I dont know how to look at the actual data. I just see Object, Object. But if I check 3 boxs, three object appear when I send so that looks like the idea is right I just dont know how to send the checked datagrid records. Any help would be great I have been at this for more than a month. The end result will be: if 3 checkboxs in the grid are checked that the SQL server would save 3 records each record would have the Cust and Seq from the datagrid along with the selections from the Program area. MY CFC looks like this

      <cffunction name="addData" output="false" access="remote" returntype="string">

      <cfargument name="user" required="no" type="struct">

      <cfquery name="qCreate" datasource="NationalAccounts">
      INSERT INTO dbo.Programs
      (SupplierID, Supplier, DBA, itemid, item, programtype, status, priority, descrip, followup, trackcomp, preslocal, tracksales, startdate, enddate, followdates)
      VALUES
      ('#Session.SupID#',
      '#Session.Sup#',
      <cfqueryparam value="#user.dba#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.itemID#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.item#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.programtype#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.status#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.priority#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.descrip#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.followup#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.trackcomp#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.preslocal#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.tracksales#" cfsqltype="CF_SQL_CHAR" />,
      <cfqueryparam value="#user.startdate#" cfsqltype="cf_sql_date" />,
      <cfqueryparam value="#user.enddate#" cfsqltype="cf_sql_date" />,
      <cfqueryparam value="#user.followdates#" cfsqltype="cf_sql_date" />
      )
      </cfquery>

      </cffunction>


      Thanks
      George
        • 1. Re: Inserting Form Data and arrayCollection
          gmurnock Level 1
          George - I'm working on something like this too and will follow this thread.

          On another note - I have been creating one RemoteObject per source and calling different methods within.

          <mx:RemoteObject id="orderManagement_ro"
          destination="ColdFusion"
          source="Components.orderMgmt.orderManagement"
          showBusyCursor="true"
          fault="errorHandler(event)">
          <mx:method name="pendingOrders" result="pendingOrdersDataHandler(event)" />
          <mx:method name="pendingOrdersExceptions" result="pendingOrdersDataExceptionsHandler(event)" />
          <mx:method name="pendingOrderDetail" result="pendingOrderDetailHandler(event)" />
          <mx:method name="tradingPartner" result="tpListHandler(event)" />
          <mx:method name="tradingPartnerLoc" result="tpLocListHandler(event)" />
          <mx:method name="orderDetailHist" result="orderDetailHistHandler(event)"/>
          <mx:method name="omExceptions" result="omExceptionsHandler(event)" />
          <mx:method name="orderExceptions" result="orderExceptionsHandler(event)" />
          <mx:method name="addComments" result="loadDetail()" />
          </mx:RemoteObject>


          For passing the variables to CF I put the arguments in the main call and everything I need in each population in a single call:

          public function loadData():void
          { orderManagement_ro.pendingOrders(customerID); orderManagement_ro.pendingOrdersExceptions(customerID); orderManagement_ro.tradingPartner(customerID);
          }
          {
          ... orderManagement_ro.addComments(orderID, customerID, userID, notes);
          }

          Might make your data come back faster.