Sending data from a combo box to a text field

  • DrGonzo
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post October 4th, 2006, 2:59 am

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.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 4th, 2006, 2:59 am

  • DrGonzo
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post October 4th, 2006, 3:26 am

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
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post October 4th, 2006, 9:38 pm

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);
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • DrGonzo
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post October 5th, 2006, 1:51 am

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
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post October 5th, 2006, 2:20 am

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
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post October 5th, 2006, 2:52 am

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 ....*/
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • bigdog
  • Born
  • Born
  • No Avatar
  • Joined: Apr 03, 2007
  • Posts: 4
  • Status: Offline

Post April 3rd, 2007, 9:00 am

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
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post April 3rd, 2007, 9:34 pm

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.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • valharta
  • Born
  • Born
  • No Avatar
  • Joined: May 29, 2007
  • Posts: 1
  • Status: Offline

Post May 29th, 2007, 12:49 pm

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 38 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.