0 Replies Latest reply on Jun 16, 2009 9:27 PM by kwbarrett_jr

    Problem passing data from datefield to CFC for DB insert/update

    kwbarrett_jr

      I'm writing an admin tool in Flex with a CF and MySQL backend.  I have a simple form with a title, text, startDate, and endDate fields.  On submit, the data is passed to a function in a CFC via the remoteObject().  I am running into problems with the data from the two datefields.  Here is my form:

       

      <mx:Form left="0" right="0" top="0"  bottom="0">

      <mx:FormItem label="Title">

      <mx:TextInput text ="{dg.selectedItem.strTitle}" id="title"/>

      </mx:FormItem>

      <mx:FormItem label="Text" width="100%" height="75%">

      <mx:TextArea text="{dg.selectedItem.strText}" id="newstext" width="100%" height="75%"/>

      </mx:FormItem>

      <mx:FormItem label="Start Date">

      <mx:DateField selectedDate="{dg.selectedItem.dtmStart}" id="startdate"/>

      </mx:FormItem>

      <mx:FormItem label="End Date">

      <mx:DateField selectedDate="{dg.selectedItem.dtmEnd}" id="enddate"/>

      </mx:FormItem>

      </mx:Form>

       

      And here are my methods calling the CFC:

       

      <mx:Script>

      <![CDATA[

      import mx.collections.ArrayCollection;

      import mx.rpc.events.ResultEvent;

       

      private var isNew:Boolean = true;

       

      public function getNewsResult(e:ResultEvent):void{

      dg.dataProvider = e.result as ArrayCollection;

      makeNew();

      }

       

      private function makeNew():void{

      title.text = "";

      newstext.text = "";

      startdate.text = "";

      enddate.text = "";

      isNew = true;

      }

       

      private function save():void{

      if(isNew){

      newsRS.createNews(title.text, newstext.text, startdate.text, enddate.text);

      }else{

      newsRS.updateNews(title.text, newstext.text, startdate.text, enddate.text, dg.selectedItem.id);

      }

      }

       

      private function deleteData():void{

      if(dg.selectedIndex > -1){

      newsRS.deleteData(dg.selectedItem.id);

      }

      }

      ]]>

      </mx:Script>

       

      On load the retrieve() method is called to populate a datagrid.  On click, the form is populated with data corresponding to the selected grid row.  User then submits which should call the insert or update method.  I see no errors, however, no update occurs for existing records and no insert occurs.  Is there something I'm missing in my method call?  Thanks.