views:

197

answers:

1

I have a combo box that is currently getting its information from a database this seems to be working fine.

Now I would like to have content from two fields displaying in the combo box at once. Say First Name & Last Name

I've added the information to the query fine but the data displayed in the combo box seems to be controlled by the labelField property and it seems to only allow one variable at a time. So it will either display First Name or Last Name but not both at once.

Does anyone know how to do this?

THANKS!

here's bit of my code

        private function NameData():void { //NAME DATA
        var stmt:SQLStatement = new SQLStatement();
        stmt.sqlConnection = sqlConn;
        stmt.text = "SELECT person_fname,person_lname FROM tbl_person ORDER BY person_fname ASC";
        stmt.execute();
        var result:SQLResult = stmt.getResult();
        acName = new ArrayCollection(result.data);
    }

.

    <mx:ComboBox id="picknameInput" x="120" y="202" width="170" labelField="person_fname" dataProvider="{acName}" prompt="- Select Name -"></mx:ComboBox>
+1  A: 

You're going to want to use the lableFunction property and have it return the two fields tied together. Here's and Example that should get you started.

invertedSpear
Thanks for pointing me in the right direction.I also found this to be very helpful - http://blog.flexexamples.com/2007/09/25/creating-a-simple-label-function-on-a-flex-combobox-control/
Adam
That's probably a better example than the one I provided. Glad you were able to make it work.
invertedSpear