PDA

View Full Version : Problem getting the value out of a ComboBox


JoakimN73
08-31-2005, 06:12 PM
Hi!
I have problems with getting the value out of a combobox in a Flash MX 2004/PHP mailform. I just get the e-mail message: info: undefined
The combobox is named info_combo. I wanted it to look like this: info = info_combo.value; but I can't get that to work out.

This is another way that I have tested, it results that a mail is sent, but the mail tells me that info is undefined. What string should I use to get the value out of the combobox?

on (release) {
info = _root.nature_of_inquiry_cb.comboBox.value;
if (name eq "" or message eq "" or info eq "" or telephone eq "" or email eq "") {
stop();
} else {
loadVariablesNum("form.php", 0, "POST");
gotoAndStop(2);
}
}
on (release) {
name = "";
message="";
telephone = "";
email="";
}

And here is how the PHP file looks like:

<?PHP
$to = "info@redpoint.se";

$msg .= "This message has been sent from your Contact Form\n\n";
$msg .= "name: " . $HTTP_POST_VARS["name"] . "\n";
$msg .= "message: " . $HTTP_POST_VARS["message"] . "\n";
$msg .= "info: " . $HTTP_POST_VARS["info"] . "\n";
$msg .= "telephone: " . $HTTP_POST_VARS["telephone"] . "\n";
$msg .= "email: " . $HTTP_POST_VARS["email"] . "\n";
$msg = utf8_decode($msg);
mail($to, $HTTP_POST_VARS["name"], $msg, "Contact Form\nReply-To:". $HTTP_POST_VARS["email"] . "\n");
?>

Please help me out! I just can't get it to work! :confused:

Best regards
Joakim

Cota
08-31-2005, 06:18 PM
Have you tried
info = info_combo.getvalue();

JoakimN73
08-31-2005, 06:35 PM
Hi!
It doesn't work. It sends a message, but when I receive it it still tells me that info: undefined

Do you know something else that I can try out?

Best regards
Joakim

Cota
08-31-2005, 06:58 PM
Lets test this real fast and see where the problem is:

on (release) {
info = _root.nature_of_inquiry_cb.comboBox.getValue();
trace(info);
trace(_root.nature_of_inquiry_cb.comboBox.getValue ());
if (name eq "" or message eq "" or info eq "" or telephone eq "" or email eq "") {
stop();
} else {
loadVariablesNum("form.php", 0, "POST");
gotoAndStop(2);
}
}
on (release) {
name = "";
message="";
telephone = "";
email="";
}


What does the trace show?

JoakimN73
08-31-2005, 07:06 PM
Hi!
When I tested the file (if I did it the right way I am not sure) it told me the following:

Output:
undefined
undefined

Does it say something to you, please let me know how to debug the file. I have only worked with Flash MX 2004 for 3 months.

/Joakim

Cota
08-31-2005, 07:07 PM
The problem has to be a scope issue. Are you calling this code on a frame where the combo box and variable do not exist?

JoakimN73
08-31-2005, 07:15 PM
I don't really get it. The form is on Scene10 of my work file. There is two layers, one with stop(); and one layer with the form.

logictude
08-31-2005, 07:17 PM
Can you tell us what


on (release) {
info = _root.nature_of_inquiry_cb.comboBox.getValue();
trace(_root.nature_of_inquiry_cb.comboBox);
if (name eq "" or message eq "" or info eq "" or telephone eq "" or email eq "") {
stop();
} else {
loadVariablesNum("form.php", 0, "POST");
gotoAndStop(2);
}
}
returns?

JoakimN73
08-31-2005, 07:20 PM
How do I make that test you want me to? Is it Debug the Movie?

JoakimN73
08-31-2005, 07:23 PM
I just run a Test Scene. The following things came up:

WARNING: The Export Frame for Classes specified in the Publish or Export settings, frame 30, does not exist. No bytecode for ActionScript 2.0 classes or interfaces was exported.
undefined
undefined

Cota
08-31-2005, 07:35 PM
Thats a new one for me. But it doesnt sound good at all.

JoakimN73
08-31-2005, 07:42 PM
When I drag out a ComboBox from the components library the box is just white and it's impossible to see the labels when I test the movie. I just wanted to see if I could make something out of a renewed box.

If you want to I could mail you the work file, but it could be tricky to test it since the content is in Swedish. However the Scene10 should be easy to see what it is all about.

Best regards
Joakim

Cota
08-31-2005, 07:48 PM
I'm not currently at a machine with flash on it. It sounds like flash is bugging out on you.