I guess I just don't see why you are saving my_cb.selected at all when
it is already store in cbInstance.selectedItem.
You could just get rid of your change handler altogether in your
original scenario and just pass the selectedItem from the combobox.
So instead of:
//( locations_cb is my combobox)
function change(evt){
evt.target.selected = evt.target.selectedItem.label
}
locations_cb.addEventListener("change", this);
create_btn.onRelease = function(){
myFunction(locations_cb.selected, [...morevalues])
}
Just use:
create_btn.onRelease = function(){
myFunction(locations_cb.selectedItem.label, [...morevalues])
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Wednesday, December 21, 2005 2:07 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Combobox none selected
My_cb.selected is simply set to capture the value of the current item
selected in my change event listener. It's a custom property I set and
pass on.
-- shouldn't that be locations_cb.selectedItem?
If I do that without selecting anything in my combobox, it captures as
[object Object]
If I select something with that code, it captures as undefined.
SelectedIndex will only return the number of the index at the selected
item.
Any other ideas?
Jason Merrill | E-Learning Solutions | icfconsulting.com
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Helen Triolo
>>Sent: Wednesday, December 21, 2005 1:47 PM
>>To: Flashcoders mailing list
>>Subject: Re: [Flashcoders] Combobox none selected
>>
>>Merrill, Jason wrote:
>>
>>>Currently, my code is:
>>>
>>>//( locations_cb is my combobox)
>>>function change(evt){
>>> evt.target.selected = evt.target.selectedItem.label
>>>}
>>>locations_cb.addEventListener("change", this);
>>>
>>>create_btn.onRelease = function(){
>>> myFunction(locations_cb.selected, [...morevalues])
>>>}
>>>
>>>This works, but only as long as something is selected from the
combobox.
>>>If nothing is selected by the user, the value gets passed as "[object
>>>Object]" - I understand why if nothing is selected, but how do I
>>>overcome this - by automatically setting something to be selected?
If
>>>so, how?
>>>
>>>I tried this when the frame containing my form is loaded:
>>>
>>>locations_cb.selectedIndex=0;
>>>
>>>
>>
>>That line does the job for me (in another project, in which I have
that
>>line right after the one in which I set the combobox dataProvider).
I'm
>>not sure what you're referring to by locations_cb.selected in your
>>function call though -- shouldn't that be locations_cb.selectedItem?
>>(or selectedIndex)
>>
>>Helen
>>
>>
>>_______________________________________________
>>Flashcoders mailing list
>>[email protected]
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
NOTICE:
This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in
error, please notify the sender immediately and delete the original. Any
other use of this e-mail by you is prohibited.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders