I'm processing my Flash Form by sending the form to a PHP script. The script
then emails the form's variables to me, but when I get my form through the
email, I get these obtrusive variables with information I don't want and makes
the information hard to find. Here's a couple of examples of the variables
I've recieved.
Name: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Times\"
SIZE=\"14\" COLOR=\"#333333\" LETTERSPACING=\"0\" KERNING=\"0\">Monkey
Test</FONT></P></TEXTFORMAT>
Email: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Times\"
SIZE=\"14\" COLOR=\"#333333\" LETTERSPACING=\"0\"
KERNING=\"0\">monkey@monkey</FONT></P></TEXTFORMAT>
I've included my PHP script in case that's the problem, but the script works
perfectly fine in a HTML form. Any help or suggestions would be greatly
appreciated, thanks.
<?php
$sendTo = "nada@nada.com";
$subject = "Nada Form";
$name=$_POST['nameField'];
$email=$_POST['emailField'];
$phone=$_POST['phoneField'];
$fax=$_POST['faxField'];
$address=$_POST['addressField'];
$message=$_POST['messageField'];
$name=trim($name);
$email=trim($email);
$phone=trim($phone);
$fax=trim($fax);
$address=stripslashes($address);
$message=stripslashes($message);
$fullMessage = "Name: ".$name."\nEmail: ".$email."\nPhone: ".$phone."\nFax:
".$fax."\nAddress: ".$address."\nMessage: ".$message;
$headers .= "Reply-To: " . $_POST["emailField"] . "\r\n";
$headers .= "Return-path: " . $_POST["emailField"];
mail($sendTo, $subject, $fullMessage);
?>
Raymond Basque - 30 May 2008 12:00 GMT
Looks like you're posting TextField.htmlText instead of TextField.text
amagen - 02 Jun 2008 19:22 GMT
I a having the same problem. RB,will you please expound on your response? Thank you
jsolo2001 - 03 Jun 2008 03:26 GMT
Hey guys, glad to know that other people have encountered the same problem!
Raymond I looked up TextField.html in the help section in Flash, it came up but
I'm not sure how to incorporate this into my action script. Here's the example
I found, would something along these lines be all the Actionscript I need?
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 400, 22);
my_txt.html = true;
Thanks
Raymond Basque - 03 Jun 2008 10:58 GMT
You need to make sure your form submission sends the plain text value of the
TextField. You do not want to send TextField.htmlText if the html property
is set to true.
Here's a simple example of what happens when you set TextField.html to true
and get the htmlText value.
var tf:TextField =
this.createTextField("my_txt",
this.getNextHighestDepth(),
10, 10, 400, 22);
tf.text = "Hello World!";
// set html to true
// the htmlText and text properties
// return different values
tf.html = true;
trace(tf.text);
trace(tf.htmlText);
// set html to false
// both htmlText and text properties
// return the same value
tf.html = false;
trace(tf.text);
trace(tf.htmlText);
jsolo2001 - 04 Jun 2008 16:23 GMT
Thanks for the example Raymond. I tried your script and have a clear idea of
how this text stuff works. The only thing is that I'm not sure how to apply
this to my form. How to send the results from e.g. -
tf.html = false;
- through email, if it's a input field. Here's my code for my submit button,
nothing fancy just gather up the variables and send.
on (release) {
if (nameField eq "" || emailField eq "" || messageField eq "") {
errorBox._x= 120;
} else {
loadVariablesNum("process.php", 0, "POST");
gotoAndStop(2);
}
}
I have a total of 6 input variables - nameField, emailField, messageField,
phoneField, faxField and addressField. What would I have to do to get the
"html=false" results to send. Add more code? If you could provide me with
another example of code for input fields that'd be great. Thanks for your help
again.
Raymond Basque - 04 Jun 2008 18:40 GMT
OK. I've never used variables attached to TextFields, but a quick test
indicates default behavior to be that if the TextField is set to "Render as
HTML" (TextField.html=true), the variable will be populated with the
htmlText value.
It would seem that the easiest way to change that behavior is to select each
TextField and unselect the property in the properties panel.