1 Reply Latest reply on Jul 3, 2007 5:37 AM by landogilator

    comboBox with dataProvider

    yarkehsiow Level 1
      hello,
      i have a comboBox which is filled with info provided by dataProvider, eg:

      ccbOne.dataProvider=["Penny","Nickel", "Dime"];

      the problem is that when clicked, "Penny" does not produce the desired effect... it only works after clicking one of the other items on the list, then going back and clicking it...
      is there a strategy for getting around this? should i just put one more item in the array saying "choose a coin" and then not include it in the if statement?

      thanks.



        • 1. Re: comboBox with dataProvider
          landogilator
          There are a variety of ways to handle this change that might result in more consistent operation In your change function, try using the ccbOne.selectedIndex to determine if a value has been selected. For instance:

          if(ccbOne.selectedIndex == 0)

          I would also recommend using attributes in your array assignment, so instead
          of ["Penny", "Nickel", "Dime"], you have [label:"Penny", label:"Nickel", label:"Dime"] or [{data:1, label:"Penny"},{data:5,label:"Nickel"},{data:10,label:"Dime"}]

          Then you can reference the combo by ccbOne.data[selectedIndex].
          So if you want to detect a Nickel: if(ccbOne.data[selectedIndex] == 5)


          However, your code may be as simple as needing oEvent.target.value.text

          Could have some syntax errors in the above, but hopefully you get the idea.

          regards

          ps...Try a trace within the change function and see what string myNewValue takes on each time you click.