4 Replies Latest reply on Sep 20, 2012 1:07 AM by BrianJ011980

    Combobox - update database with ID associated to value selected

    BrianJ011980

      Hello, first off i'm a newbie to developing Flash Builder with PHP, so any help would be mucho appreciated.

       

      I would like to update my database with an id associated to a seletcted value in a combobox

       

      - I create a combox and asociate it to a data service that retrieves all possible values

      - Using selectedItem, I am able to default the value of the combobox to the value associated to the data object

      - Upon submission, I would like to update the database not with the value directly but with its associated id.

      - The list of values are a list of locations all with a specific id.

       

      Below is my code

       

      //Combobox in a form

       

      <s:Form includeIn="LocationAdd,LocationUpdate" x="52" y="320" defaultButton="{auLocnBtn}">

           <s:FormItem label="Supplier ID">

             <s:ComboBox id="spidComboBox" selectedItem="{locations.snam}" includeIn="LocationUpdate" x="97" y="539"

                                                                  creationComplete="comboBox_creationCompleteHandler(event)" labelField="name">

             <s:AsyncListView list="{getSplResult.lastResult}"/>

             </s:ComboBox>

           </s:FormItem>

           <s:Button id="auLocnBtn" label="Submit" click="auLocnBtn_clickHandler(event)" label.LocationUpdate="Update" label.LocationAdd="Add"/>

      </s:Form>

       

      protected function auLocnBtn_clickHandler(event:MouseEvent):void

           {

                locations.spid = parseInt(spidComboBox.selectedItem);

                updateLocationResult.token = locationService.updateLocation(locations);

           }

       

      This code will pass the selected item, in this case locations.snam. However, getSpl returns two fields - name and id. I want the id associated to locations.snam to be used to update the database.

       

      Doing this in php and html is really straight forward as there is a <value> property that allows me to pass the id. Anything similar in flash builder??? I have spent hours on this...please don't laugh, I said I was new to FB!

       

      Cheers,

      Brian