PDA

View Full Version : Combo box: retrieving content with actionscript.


sai_digitalle
06-04-2005, 05:16 AM
my question is simple. I put together an e-mail form using some text input components and some 1 combo box with 5 labels (wedding photography, family photography, etc...) I understand how to and have successfully scripted the text input boxes so that i can rerieve what the visitor inputs into it and then it finally gathers it all together and e-mails it to me.

with text input boxes my code goes like this:
contactForm.userEmail.text ---------- and this gathers the text in the text input box assigned the name "userEmail."

but combo boxes are different, right? I named the combox "userOptions." And it's also rooted in "contactForm. so how would i code it?
contactForm.userOptions.text <------should i use text? Well anyway, when i use "text" at the end, that field still returns the result of "UNDEFINED!" i am limited on actionscript knowledge.

besides "text" at the end what should i use?

madgett
06-04-2005, 08:26 PM
Look up Combobox class in the Flash Help, and it will tell you all the methods you can call on it. You use the combobox.change event to detect a user selected value, you can also look that up in the Flash Help.

To retrieve the text of a label on the combobox you can use this and the change event:
var comboLis:Object = new Object();
comboLis.change = function(evtObj:Object) {
var thetext:String = contactForm.userOptions.getItemAt(evtObj.target.se lectedIndex).label;
};
contactForm.userOptions.addEventListener("change", comboLis);