Sending data from a combo box to a text field

  • DrGonzo
  • Beginner
  • Beginner
  • DrGonzo
  • Posts: 36

Post 3+ Months Ago

Hello all,
I have a flash form with a combo box in. I want the data selected in the combo box to appear in a text filed next to it, so I can send the info by email through PHP.
Anyone know how to do this?

Thanks,

DrGonzo.
  • DrGonzo
  • Beginner
  • Beginner
  • DrGonzo
  • Posts: 36

Post 3+ Months Ago

No Worries - i've worked it out.

All I did was put this in the actions layer:

onEnterFrame = function(){
colour_txt.text = colourBox.value;
}

colour_txt is the instance name of my text field, colourBox is the instance name of my combo box.

Also, I hid my text field behind another object on the stage, so the user won't see it, but the data can still be sent....

Thanks,

DrGonzo.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

yea, that could do too, but they implemented listeners so you can know exactly when the value was changed, so you won't have to change the colour_txt each time the enterFrame event is accessed.
Code: [ Select ]
objComboListener = new Object();
objComboListener.change = function(eventObj){
  colour_txt.text = eventObj.target.value;
}
colourBox.addEventListener("change", objComboListener);
  1. objComboListener = new Object();
  2. objComboListener.change = function(eventObj){
  3.   colour_txt.text = eventObj.target.value;
  4. }
  5. colourBox.addEventListener("change", objComboListener);
  • DrGonzo
  • Beginner
  • Beginner
  • DrGonzo
  • Posts: 36

Post 3+ Months Ago

Cool, thanks Ice,
I'm totally 100% newbie to web design - do you know any decent tut sites on flash - specifically classes & listeners (they keep cropping up - I don't know how to use them properly!)

Thanks,

DrGonzo
  • DrGonzo
  • Beginner
  • Beginner
  • DrGonzo
  • Posts: 36

Post 3+ Months Ago

Sorry - another quick Q :

Could I use the above listener to make each different selection in a combo box act as a button (I want the text in my text field to change colour depending on which box label is chosen) if I set up an array of the data in the combo box - could I then say each choice peforms a different function?

Thanks,

DrGonzo.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

about listeners ... just read the help from flash.

use the myComboBox.selectedIndex property or the myComboBox.value property and then make a switch case. i.e.:
Code: [ Select ]
// if u switch after the index
var nIndex = Number(myComboBox.selectedIndex);
switch (nIndex)
{
  case 0: do something ; break;
  case 1: do something ; break;
  case 2: do something ; break;
  // ............
}

/* if u switch after the value, do it with if (value == something) { do this} else if (value == something else) { do that} else if (value == something different) { do something } else if ....*/
  1. // if u switch after the index
  2. var nIndex = Number(myComboBox.selectedIndex);
  3. switch (nIndex)
  4. {
  5.   case 0: do something ; break;
  6.   case 1: do something ; break;
  7.   case 2: do something ; break;
  8.   // ............
  9. }
  10. /* if u switch after the value, do it with if (value == something) { do this} else if (value == something else) { do that} else if (value == something different) { do something } else if ....*/
  • bigdog
  • Born
  • Born
  • bigdog
  • Posts: 4

Post 3+ Months Ago

Hi all

I'm very new to Flash 8 and need something really simple. I want to create one input text field where users can type their message and then submit it to my email, using PHP.

So far I've tried everything and nothing is working.

My actionscript is:

on(release){
messager.loadVariables("email.php","POST");
}

where messager is the movieclip instance as well as the name of the input text field variable.


My PHP script is:

<?php
$to = $_POST["bigdog@hotmail.com"];
$message = $_POST["message"];
mail($to, $message);
?>


When I upload to the web and click the submit button, nothing happens. I'm sure this is a fairly simple action but I just can't get it to work.

Please help me with this.

Many thanks in advance.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

but of course, when you try to catch a rabbit using a fishing stick you can say you tried everything and you didn't succeed :D
sending mail debate ...
also you can search either in this forum or in google for: "flash send mail"
After you did all these you can say that you tried everything.
  • valharta
  • Born
  • Born
  • valharta
  • Posts: 1

Post 3+ Months Ago

Hi guys! can someone help with my problem heres my code:

onEnterFrame = function(){
DateA.Number = DAboxA.value;
MonthA.Number = MAboxA.value;
YearA.Number = YAboxA.value;
DateD.Number = DD.label;
MonthD.Number = MD.label;
YearD.Number = YD.label;
}


and on my button code:

else if (!DateA.value) {
DateA = "Enter a Date";
}

i cant seem to get the value of the combo box and always get the enter a date message.
my combo box name is DAboxA and the text input dateA.

thanks!

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 5 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
 
cron
 

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