Sending combobox data as variables to php

  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122

Post 3+ Months Ago

Trying to create a complicated email form in flash. I know all the input text fields can have var assigned to them, but the component combobox cannot. Can it's instance name work the same way? or How can I make each data entry (8 in total) in the combobox be sent as a separate variable to php? How, can I put a variable onto the comobox????

thx :oops:
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Sledgehammer
  • Genius
  • User avatar
  • Posts: 13496
  • Loc: Florida

Post 3+ Months Ago

Yep, assign the comboBox an instanceName and collect data like so,

to store all items in an array, (of course you can swap the array with a loadVars() )
Code: [ Select ]
labelArray = new Array();
dataArray = new Array();
for (i = 0; i < comboBox.getLength()-1; i++) {
   labelArray[i] = comboBox.getItemAt(i).label;
   dataArray[i] = comboBox.getItemAt(i).data;
}
  1. labelArray = new Array();
  2. dataArray = new Array();
  3. for (i = 0; i < comboBox.getLength()-1; i++) {
  4.    labelArray[i] = comboBox.getItemAt(i).label;
  5.    dataArray[i] = comboBox.getItemAt(i).data;
  6. }

to get the selectedItem,
Code: [ Select ]
var selectedLabel = comboBox.getSelectedItem().label;
var selectedData = comboBox.getSelectedItem().data;
  1. var selectedLabel = comboBox.getSelectedItem().label;
  2. var selectedData = comboBox.getSelectedItem().data;


:D
  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122

Post 3+ Months Ago

Ahh great!! Thanks :D
  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122

Post 3+ Months Ago

well, I can't get it to send into the php though, what am I doing wrong? On the button I have the code set like this:

Code: [ Select ]
on (release) {
    
    labelArray = new Array();
    dataArray = new Array();
    for (i = 0; i < comboBox.getLength()-1; i++) {
       labelArray[i] = comboBox.getItemAt(i).label;
       dataArray[i] = comboBox.getItemAt(i).data;
        }
    
    var selectedLabel =    comboBox.getSelectedItem().label;
    var purpose = comboBox.getSelectedItem().data;
    
    form.loadVariables("email.php", "POST");
}
  1. on (release) {
  2.     
  3.     labelArray = new Array();
  4.     dataArray = new Array();
  5.     for (i = 0; i < comboBox.getLength()-1; i++) {
  6.        labelArray[i] = comboBox.getItemAt(i).label;
  7.        dataArray[i] = comboBox.getItemAt(i).data;
  8.         }
  9.     
  10.     var selectedLabel =    comboBox.getSelectedItem().label;
  11.     var purpose = comboBox.getSelectedItem().data;
  12.     
  13.     form.loadVariables("email.php", "POST");
  14. }
  • joebert
  • Sledgehammer
  • Genius
  • User avatar
  • Posts: 13496
  • Loc: Florida

Post 3+ Months Ago

Check my post here http://www.kirupaforum.com/forums/showt ... hp?t=57254 for information on LoadVars() in flash, everything is the same in flash for PHP as it would be in the ASP example.

Also to send the comboBoxs selected items label, give this to one of the Passengers you will learn about in the post. :D

Code: [ Select ]
comboBox.getSelectedItem.label;
  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122

Post 3+ Months Ago

lol your post was hilarious yet informative. ill try that out... the problem i was having was to send all info at once, so the loadvars should be fine and SO easy.
  • Passerose
  • Born
  • Born
  • Passerose
  • Posts: 1

Post 3+ Months Ago

Hello Starqueen,

Any chance you could mail me the fla of the form you created. I'm looking to do exactly the same but can't get my head round the scripting.

Thanks,

Passerose.

passerose@uber-music.com

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.