2 Replies Latest reply on Sep 3, 2008 5:34 PM by wkolcz

    ComboBox data

    wkolcz Level 1
      I have a combobox that uses an ArrayCollection to populate it. I can't seem to get the 'data' from it though. What am I missing?

      I know the ArrayCollection works fine, but when I select the 2 'breeds', it gets populated with nothing.

      Here is my comboBox
      <mx:ComboBox id="breed1_txt" visible="false" toolTip="Select the dominant breed of the pet" dataProvider="{breedTypes}" labelField="breedName" />

      Here is my create function when the form is submitted:
      public function addPet(e:Event):void {
      var petInfo:Object = new Object();
      petInfo.petName = petName_txt.text;
      petInfo.petType = petType_txt.selectedItem.data;
      petInfo.petBreed = breed1_txt.selectedItem.data;
      petInfo.petBreed2 = breed2_txt.selectedItem.data;
      petInfo.petGender = petGender_txt.selectedItem.data;
      petInfo.petAge = petAge_txt.selectedItem.data;
      petInfo.petColors = petColors_txt.text;
      petDAO.create({petData:petInfo});

      }

      petBreed1 and petBreed2 end up empty. Any clues?
        • 1. Re: ComboBox data
          Level 7

          "projectproofing" <webforumsuser@macromedia.com> wrote in message
          news:g9mm3d$q11$1@forums.macromedia.com...
          >I have a combobox that uses an ArrayCollection to populate it. I can't seem
          >to
          > get the 'data' from it though. What am I missing?
          >
          > I know the ArrayCollection works fine, but when I select the 2 'breeds',
          > it
          > gets populated with nothing.
          >
          > Here is my comboBox
          > <mx:ComboBox id="breed1_txt" visible="false" toolTip="Select the dominant
          > breed of the pet" dataProvider="{breedTypes}" labelField="breedName" />
          >
          > Here is my create function when the form is submitted:
          > public function addPet(e:Event):void {
          > var petInfo:Object = new Object();
          > petInfo.petName = petName_txt.text;
          > petInfo.petType = petType_txt.selectedItem.data;
          > petInfo.petBreed = breed1_txt.selectedItem.data;
          > petInfo.petBreed2 = breed2_txt.selectedItem.data;
          > petInfo.petGender = petGender_txt.selectedItem.data;
          > petInfo.petAge = petAge_txt.selectedItem.data;
          > petInfo.petColors = petColors_txt.text;
          > petDAO.create({petData:petInfo});
          >
          > }
          >
          > petBreed1 and petBreed2 end up empty. Any clues?

          selectedItem should already _be_ the data that was used for the
          itemRenderer.

          HTH;

          Amy


          • 2. Re: ComboBox data
            wkolcz Level 1
            I found out that When I set the combobox to an ArrayCollection I can pull ANY data from the original recordset.

            So since the ArrayCollection includes the breedID, breedName, and more data. I just changed the function to include breed1.selectedItem.breedID and it worked.

            Thank for the feedback.