1 Reply Latest reply on Mar 28, 2009 12:06 PM by John Hall

    combobox problem

    jason_y Level 1
      Hi,

      I have a <mx:combobox> whick receives data from the database (via remoteobject). It would then generate an HTML-type drop-down with an ID for the "value" and some text (in this case, states) for what the user sees in the drop-down. I am able to get the latter displayed, but I couldn't get the ID "value". I was wondering if there is an easy way to do this?

      The query I have is and I want to put "Provincestate_Id" as the value and "Provincestate_Name" as what the user sees:
      SELECT Provincestate_Id,
      Provincestate_Country_fk,
      Provincestate_Code,
      Provincestate_Name
      FROM Provincestate
      ORDER BY Provincestate_Name

      Jason

        • 1. Re: combobox problem
          John Hall Level 4
          From the snippet and no test data to try, I would guess you want a label function. I assume you're looping over the array. So instead of labelField, try labelFieldFunction. Something along the lines of (untested):

          <mx:ComboBox
          id="Customer_State_insert"
          editable="false"
          dataProvider="{StateArray}"
          labelFieldFunction ="getStateName" />

          In script block, something like:
          private function getStateName(o:Object):String {
          return o.Provincestate_Name;
          }