Data to ComboBox

I have a combobox that uses ArrayCollection collection to fill. I can't not get the 'data' property. What Miss me?

I know the collection ArrayCollection works fine, but when I select the 2 'races', it gets filled by anything.

Here's my comboBox
< mx:ComboBox id = "breed1_txt" visible = "false" toolTip = "select the dominant race of the pet" dataProvider = "{breedTypes}" = 'breedName' labelField / >

Here is my function create when the form is submitted:
public void 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. Clues?

I discovered that when I set the combobox control to an ArrayCollection collection I can pull ALL the data of the original Recordset.

As far as the ArrayCollection collection includes breedID, breedName and more data. I just changed the function to include breed1.selectedItem.breedID and it worked.

Thanks for the comments.

Tags: Flex

Similar Questions

  • Extract a part of SelectedItem.data of ComboBox

    Hello!

    I only use AS2.

    A ComboBox is filled with elements all built on the same pattern:

    Each element contains:

    1 - name of the location (which can contain hyphens, spaces and apostrophes)

    2 - details (always indicated in parentheses)

    The user selects an item that will be sent to research purposes via PHP to query a MySQL database.

    The variable to send should only be the name of the place , because the location of my MySQL Table column contains the names of place without details.

    How can I extract only the name of the place?

    Thank you very much in advance for your help!

    Best regards.

    You can use...

    dataToSend = String (yourCBName.selectedItem.data) .split ("(") [0]; ")

    where 'yourCBName' is replaced by any name you assign to the combobox

    This line will split the data line in two parts where begins the parentheses and point to the first part of it.

    We know not if you use the appearance selectedItem.label of the combobox, that could help.  What you might consider doing is to have just the data part of the combobox control have the data you want to send, and use of the part of the label to display the entire bit of text you show... or the reverse of the where the label is just the part of name and that is what you send.

  • How to recover data from combobox?

    Hey guys!

    I do a purchase order, where the user can enter its coordinates and then choose a product in a menu drop-down.

    So far, I have just given the variable dynamic text fields and used this code:

    on (release) {
         form.loadVariables("order.php", "POST");
    }
    

    But now that I added a ComboBox, there 'variable scope' pitch - how to send the parameter selected in the combobox control to the PHP as well?


    Thank you!!

    your combobox has a selectedItem property, you can use:

    var yourcomboboxselectedItem:String = cb.selectedItem.data;  If you combobx has instance name cb and you want to retrieve the property data

  • Recover data to ComboBox

    Hello!

    I have a ComboBox with a dataProvider, which is a collection of ArrayCollection.

    The variable AC, we'll call merge, is like this:

    Merge = newArrayCollection ([{Label: 'One', data: 1, "year": "2009"}, {label: 'Two', data: 2 'year': 10 0 BC'}]);

    For the above example, I need to get all the data from the merged for the selected item.

    To get the label and the data for it, I can use myComboBox.text and myComboBox.value.

    Q: How can I get the value of the year?

    Thank you!

    myComboBox.selectedItem;
    
  • Flex 3: property data Combobox is not recognized

    Hello

    Why is the data property Combobox is not recognized?

    I have a Simple drop-down list box, in respect of the change of the said event, a function is to be called and under this combobox.data doesn't think?

    <? XML version = "1.0" encoding = "utf-8"? >

    "< mx:Application xmlns:mx ="http://www.adobe.com/2006/mxml"layout ="absolute">"

    < mx:Array id = "myarray" >
    < mx:String > One < / mx:String >
    < mx:String > two < / mx:String >
    < mx:String > 3 < / mx:String >
    < / mx:Array >

    < mx:Script >

    <! [CDATA]
    Import mx.controls.Alert;

    public void label1_creationCompleteHandler(event:Event):void
    {

    if(MyComboBox.Data>1)
    {
    Alert.Show ('Hi');
    mycombobox.setStyle('backgroundColor','#137EC2');
    }
    }

    []] >
    < / mx:Script >
    < mx:ComboBox id = "Mazonedelistederoulante" dataProvider = "{myarray}" creationComplete = "label1_creationCompleteHandler (event)" >
    < / mx:ComboBox >
    < / mx:Application >

    Hi Kiran,

    You should not use the property data in this context. IT, real goal comes in the image when you work / are using itemRenderers and itemEditors.

    More on the if(mycombobox.data>1) of the condition will be satisfied not why because your mycombobox.data is equal to the null value and therefore the condition fails.

    data property
    data:Object[read-write]

    The data property allows you to pass a value to the component when you use it in an item converter or editor element. You use data binding to bind a field of the data property for a property of this element.

    The ComboBox control use it listData property and the data property as follows. If the ComboBox in a DataGrid control, it expects the dataField property of the column to map to a property in sets of data and selectedItem to this property. If the ComboBox control is in a list control, it is expected that the labelField of the list to map to a property in sets of data and selectedItem to this property. Otherwise, it sets selectedItem to the data itself.

    You do not set this property in MXML.

    This property can be used as the source for data binding.

    Thank you

    Jean Claude

  • Flex 3 combobox item list dropdown wordwrap issue

    I placed a combobx inside VBox (width = 200).

    COMBOX width is set to 100% and combobox with arraycollection as a dataprovider collection.

    now the data of combobox items are too long, so my combobox is not perfectly placed.

    combobx width is set to a maximum length of the data element.

    How can I set property combobox data WrapMode list Word so it won't be perfectly placed in VBox.

    I tried to put the dropdown property to open() and the creationComplete() event.

    When the application loads, combobox width out of Vbox width limit.

    If you use % width, the measuredWidth becomes the minWidth.  You want to

    Override her so he can make smaller.

  • Overall maintenance of the lists for ComboBox values

    I like to keep a list of eligible categories multilingual to be used
    in the ComboBox controls. The values for these lists must be stored outside the
    the application or an overall level at which they can be maintained by a person
    which is not necessarily a developer.

    When the user chooses a language when the application runs, the arrayCollections
    containing the data/value pairs must be loaded with the data in the appropriate
    language. These arrayCollections will then be linked as data providers
    ComboBox controls in the various modules and components of the application.

    For example, in an application on cars, it might be a ComboBox containing
    colors - in English (red, grey, blue, black) German (grau, blau, rot, schwarz).
    There could also be a ComboxBox containing body types: (sedan, cut, convertible)
    or (limousine, cut, cabriolet).

    ComboBoxes, using the data could be used anywhere in the application - in modules,
    components or something else.

    What would be the best way to address the issue from a design perspective? Where should
    store the lists to be loaded in the data provider of the control at run time?


    Scott

    Resource modules.

  • Using HTTPService to fill Combobox from DB SQL

    I'm having a little problem with the filling of a combobox after I call a httpservice. Showing data, however, it's all appear on a single line over several items to combobox. For example, I get a single line in the drop-down menu that looks like this:

    DATE1, DATE2, DATE3

    instead of get:

    DATE1
    DATE2
    DATE3

    I found this article, but it does not really my problem and I already seem to wear all recommended in this article ( http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60 & catid = 585 & threadid = 1220768 & highlight_key = y & keyword1 = combobox).

    Part of my PHP script:
    -----------------------------------------------
    $return = '< horodateurs > ';
    While ($Row = mysql_fetch_array ($result))
    {
    $qrtrdisp is $row ["quarter"];.
    $return. = "< date >." $qrtrdisp. "< / date > ';
    }
    $return. = ' < / timestamps > ';
    Print ($Return);
    -----------------------------------------------

    Part of my MXML file:
    -----------------------------------------------
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "absolute" creationComplete = "getDates.send ()" >

    <!-set call to enter the dates for the shape->
    < mx:HTTPService id = "getDates" url = "https://url/file.php" useProxy = "false" method = "GET" showBusyCursor = "true" >
    < / mx:HTTPService >

    < mx:ComboBox id = "dates" x = "201" y = "6" dataProvider = "{getDates.lastResult.timestamps}" labelField = 'date' > < / mx:ComboBox > ""
    -----------------------------------------------

    Any help would be greatly appreciated.

    Thank you
    Chris

    You may need to structure xml youre differently. You set the dataprovider for the timestamps down, try each date in its own node parent and dot up to getDates.LastResult.timestamps of packaging. (the new node)

  • To detect a change in a Variable?

    Hi all

    I can detect a change in variable (a string of data)?

    I do an AS2 SWF (level 7 Player) with navigation of the combobox control.

    I have a page name variable that I change from outside the SWF with the Director and Authorware using (I think) FlashVars.

    The variable (internally) is set by default when SWF is initialized.

    Authorized external variable values are always one of the combobox data field values.

    The combobox default variable is not always the index 0 (zero) position. Or the order of the data or the other.

    The variable can be modified internally in combobox nav used to independent navigation of the external variable. -It works

    When the nav var shared changes of the external source, the ComboBox must change for the variable game data to combobox corresponding. That's what I'm trying to do.

    I can change the drop-down list Configuration programmatically (index), but failed to recognize him as a change event. Or tell him by programming

    The combobox control can be selected by the data variable, or is the only option to use the index (loop index values to match the variable data field)?

    And update the selection combobox (and therefore the nav page) by triggering a change by programming event?

    Detect the var itself without the OnEnterFrame turn change is my goal - if it even works in the version I use (flash palyer 7).

    Thank you

    Jim

    You can use watch(). I have not used for some time, so you will need to check the documentation.

  • How to use a variable to set properties of movie clip?

    I build a simple contact page that allows users to select a city in a comboBox. I want to transmit the data to comboBox selected by a variable that controls a clip with the same name. (already on the scene)

    locationListener.change = function (loc_obj:Object) {}
    var loc_mc = loc_obj.target.selectedItem.data;
    loc_mc._visible = true;

    So far, this has not worked. I tried to hardcode the instance name of clip film (Atlanta._visible = true) and it works, but I can't understand why using the loc_mc variable does not trigger an interaction with the clip.

    Something simple, I guess. Thanks in advance for any help.

    my bad (target), obtained, use eval to get the path:

    locationListener.change = {function (loc_obj:Object)}
    eval (loc_obj.target.selectedItem.data) ._visible = true;
    }

  • How can I get data from each associated XMLnode in movieclips separated when you click a line in the combobox

    How can I get data from each associated XMLnode in movieclips separated when you click a line in the combobox?

    A sample of XML is like this:

    <>planter

    < Lauvtre >

    < Botanisk_navn > Acer campestre < / Botanisk_navn >

    < Norsk_navn > Naverlonn < / Norsk_navn >

    Gronn < Farge > < / fan >

    H4 < Herdighet > < / Herdighet >

    < Hoyde > 10-15 m < / Hoyde >

    < / Lauvtre >

    I have a combobox where it shows the botanical name and the Norwegian name. But the rest of the info in movieclips seem separate.

    Someone has an idea how to do this? Can I use the trace function maybe? Here is my AS3 code so far:

    var loader: URLLoader = new URLLoader();

    loader.addEventListener (Event.COMPLETE, onLoaded);

    list.addEventListener (Event.CHANGE, itemChange);

    function itemChange(e:Event):void

    {

    your. Text = list.selectedItem.data;

    TB. Text = list.selectedItem.label;

    }

    var xml;

    function onLoaded(e:Event):void

    {

    XML = new XML (e.target.data);

    var it: XMLList = xml. Planter.Lauvtre;

    for (var i: uint = 0; i < il.length (); i ++)

    {

    list.addItem ({data: it.}) Farge.Text ([i]) + "\n"+ it.» Herdighet.Text ([i]) + "\n" + it. Hoyde.text ([i]),

    label: it. Botanisk_navn. Text() [i] + "\n"+ it.» Norsk_navn. Text() [i]});

    }

    }

    Loader.Load (new URLRequest ("lauvtre.xml"));

    Thank you!

    Rheus.

    I don't know what you're trying to do.  but, if you want to fill one combobox with the botanical names and when one is chosen, the other use of logins:

    var loader: URLLoader = new URLLoader();

    loader.addEventListener (Event.COMPLETE, onLoaded);

    list.addEventListener (Event.CHANGE, itemChange);

    function itemChange(e:Event):void {}

    var selectedObj:Object = a [list.selectedIndex]

    trace (selectedObj ['fan'], selectedObj ['Botanisk'], etc);

    }

    var xml;

    var a: Array = [];

    function onLoaded(e:Event):void {}

    XML = new XML (e.target.data);

    var it: XMLList = xml. Lauvtre;

    for (var i: uint = 0; i

    list.addItem({label:il[i].child('Botanisk_navn').toString()});)

    a [i] = {'Fan': it [i].child('Farge').toString (), 'Herdighet': it [i].child('Herdighet').toString (), "Hoyde": he [i].child('Hoyde').toString (), 'Botanisk':il[i].child('Botanisk_navn').toString(),'Norsk_navn':il[i].child('Norsk_navn').toString()};}

    }

    }

    Loader.Load (new URLRequest ("test.xml"));

  • Fill ComboBoxes with some Date Formats

    Hello, I need to show the day, month and year in three separate ComboBoxes for my project. Is it possible to combine and concentrate all ComboBoxes together?  For example, I want to get all the values for the Date of the birth of three days of combo boxes, month and year.

    Can someone help me please?

    If you want your users to select date, month and year of your 3 comboboxes?  If so, you can use the following syntax and access the properties of the 3 comboboxes selectedLabel:

    Import fl.data.DataProvider;

    import flash.events.Event;

    var month is ["jan", "feb", "mar", "Apr", '' may '', "jun", "Jul", "aug", "sep", "oct", "nov", "December"];.

    var dp:DataProvider = new DataProvider (monthA);

    monthCB.dataProvider = dp;

    var dataA:Array = [];

    setDatesF (31);

    function setDatesF(n:int):void {}

    for (var i: int = 1; i<=n; i++)="">

    dataA.push (i);

    }

    DP = new DataProvider (dataA);

    dateCB.dataProvider = dp;

    }

    var yearA:Array = [];

    for (var i: int = 1900; I)<2100; i++)="">

    yearA.push (i);

    }

    DP = new DataProvider (year);

    yearCB.dataProvider = dp;

    monthCB.addEventListener (Event.CHANGE, monthF);

    function monthF(e:Event):void {}

    var d: Date = new Date (yearCB.selectedLabel, 1 + monthA.indexOf (monthCB.selectedLabel), 0);

    setDatesF (d.date);

    }

  • ComboBox and dynamics of data?

    Hi all

    I use php to pass FlashVars for my film to get the list of courses and dates - it works very well.

    FlashVars data comes in as simple strings.

    Then I want to use two comboboxes to list the courses and dates of these courses are available.

    I tried this and MANY other versions, but in vain. (See attached code).

    I also played withComboBox.removeItemAt () and ComboBoxReplaceItemAT() but again without success.

    Any ideas most welcome...

    Best wishes

    Tony

    - - - - - - - - - - -

    CODE:

    GET NAMES OF COURSE DATA
    course_cb. AddItem ({data: _root.course_name1, label:_root.course_name1});})
    course_cb. AddItem ({data: _root.course_name2, label:_root.course_name2});})
    course_cb. AddItem ({data: _root.course_name3, label:_root.course_name3});})
    course_cb. AddItem ({data: _root.course_name4, label:_root.course_name4});})

    Date_cb CHOOSE a COURSE and FILL it with the correct date:

    var postlisten: Object = new Object();
    course_cb.addEventListener ("change", postlisten);

    postlisten.change = function() {}
    post = (course_cb.value);
    date_cb. Enabled = 1;
    date_cb._alpha = 100;
    If (course_cb.label = _root.course_name1) {}
    date_cb. AddItem ({data: _root.course_date1, label: course_date2});
    } else if (course_cb.label = _root.course_name2) {}
    date_cb. AddItem ({data: _root.course_date2, label:_root.course_date3});})
    } else if (course_cb.label = _root.course_name3) {}
    date_cb. AddItem ({data: _root.course_date3, label:_root.course_date3});})
    } else if (course_cb.label = _root.course_name4) {}
    date_cb. AddItem ({data: _root.course_date4, label:_root.course_date4});})
    }
    };

    Oh.

    When the test for equality, you must use the double equal (==).  otherwise, you're assiging the left side of the = operator to ensure that the value on the right side:

    postlisten.change = function() {}
    post = (course_cb.value);
    date_cb. Enabled = 1;
    date_cb._alpha = 100;
       
    If (course_cb.selectedItem.label == _root.course_name1) {}
    date_cb. Text = _root.course_date1;
    } Else if (course_cb.selectedItem.label == _root.course_name2) {}
    date_cb. Text = _root.course_date2;
    } Else if (course_cb.selectedItem.label == _root.course_name3) {}
    date_cb. Text = _root.course_date3;
    } Else if (course_cb.selectedItem.label == _root.course_name4) {}
    date_cb. Text = _root.course_date4;
    }
    };

  • Flex 3: data of the ComboBox should appear in different colors:

    Hello

    I use ArrayCollection as a DataProvider collection to my Flex 3 Combobox component.


    Please tell me how to make the data in the COmbobox to appear in different colors?

    Indicate if you please, thank you.

    Custom itemRenderer

  • Need help ComboBox and data

    How I do the selected label and the data in my combobox appears in a dynamic text box in macromedia flash 8? Help me please thank you.

    I don't know where you are with things, but what version of Flash you're using, and what version of Actionscript, your file is configured to use, to search the ComboBox in the help documents and go through the propertties and methods that support it.  You are likely to find examples that you can experiment with and make it work for you.  That what I did before I responded to your ad.

Maybe you are looking for