2 Replies Latest reply on Jun 29, 2007 11:49 AM by Newsgroup_User

    Data not binding

    Level 7
      Can somebody point out what I am missing to bind the data from my form
      into my data model? There does not seem to be any data in the
      troubleEvent object when the save() function runs.

      Code:
      ------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Panel
      xmlns:mx=" http://www.adobe.com/2006/mxml"
      xmlns:Ctrl="Components.Controls.*"
      layout="absolute"
      top="10" left="10" right="10" bottom="10"
      title="ITB Trouble Log">

      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      import Model.troubleLog;

      [Bindable]
      protected var troubleEntry:troubleLog = new troubleLog;

      protected function save(troubleEvent:Object):void
      {
      Alert.show('test "' + troubleEvent.application + '"');

      parentApplication.troubleLogDAO.save(troubleEvent.application,troubleEvent);
      }
      ]]>
      </mx:Script>
      <mx:VBox>
      <mx:Form>
      <mx:FormItem label="Application">
      <mx:TextInput text="{troubleEntry.application}"/>
      </mx:FormItem>
      </mx:Form>
      <mx:Button label="Submit" click="save(troubleEntry)"/>
      </mx:VBox>
      <mx:Button label="Trouble Log" right="10" top="10"
      click="{parentApplication.troubleLog.selectedIndex=0}"/>
      </mx:Panel>
        • 1. Re: Data not binding
          ntsiii Level 3
          How is "troubleEvent " getting populated to start with?
          Tracy
          • 2. Re: Data not binding
            Level 7
            ntsiii wrote:
            > How is "troubleEvent " getting populated to start with?
            > Tracy


            At this point it is not. It is using an AS data model and defaulting to
            empty|null values. I have figured out one way to bind the model to the
            form items using <mx.binding...> tags. I imagine there is a cleaner way
            to do this and would love to hear them.

            Back to your question. I need to learn how to initially populate the
            'troubleEvent' with a remote object call based on the selected item in a
            data grid in another custom MXML control that called this MXML control
            when selected.