dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash PHP Email Form, Text Formatting Problem

  1. #1
    Junior Member
    Join Date
    Jun 2001
    Posts
    3

    Flash PHP Email Form, Text Formatting Problem

    Hello all,

    I am running into a problem with a flash form that worked fine for Flash 6 but when run with Flash 8 the resulting form data comes across in email with additional text formatting information. Is there a way to strip out this formatting info? I'd appreciate any help. I'm a novice at this and haven't been able to come up with a solution. I am using Flash CS3.

    Below is an example of what shows up in email when it should just say "test":
    <P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"12\" COLOR=\"#000000\"
    LETTERSPACING=\"0\" KERNING=\"0\">test</FONT></P>

    Here is the actionscript I'm using:
    on (release) {
    holder = new LoadVars();
    holder.firstName = _parent.form.firstName;
    holder.lastName = _parent.form.lastName;
    holder.phone = _parent.form.phone;
    holder.email = _parent.form.email;
    holder.mymessage = _parent.form.mymessage;
    holder.howHear = _parent.form.howHear;

    _parent.form.firstName = "";//set all input fields to ""
    _parent.form.lastName = "";//set all input fields to ""
    _parent.form.phone = "";//set all input fields to ""
    _parent.form.email = "";//set all input fields to ""
    _parent.form.howHear = "";//set all input fields to ""

    _parent.form.mymessage = "Your message has been sent. Thank you.";
    holder.sendAndLoad("contact_form_submit.php",holde r,"POST");
    holder.onLoad = function() {
    };
    }

  2. #2
    Junior Member
    Join Date
    Jun 2001
    Posts
    3

    figured it out

    Wow, well this was tough, but I know you gotta dig in and churn through these problems sometimes. I'm posting the solution I found in case anyone else runs into this problem.

    It turns out what was creating this problem was the use of the "var" for the text input. Instead of referencing the input field as a variable (which captures the text formatting), you need to give each text field an instance name. So if you have a field with the instance name "lastName" and you want to capture that value to a LoadVars array named "holder", you would just add something like this line to your actionscript...

    holder.lastname = _parent.form.lastName.text;

    I'm sorry if my explanation is a little clunky, I'm still a bit of a noob with this. The key though is to use the instance name field, not the var field. That lets you access just the text that was typed in, by using that nifty little ".text" when referencing the input field in your actionscript.

    Goodbye funky formatting

  3. #3
    Has Returned
    Join Date
    Mar 2001
    Posts
    269
    I am having this problem when i am sending information stored in a text box to ASP. However if i use an instance name instead of the var field it is sending "undefined".

    What am i doing wrong?

    PHP Code:
        var user:LoadVars = new LoadVars();
        
    user.username txtName.text

  4. #4
    Has Returned
    Join Date
    Mar 2001
    Posts
    269
    Sorry i have been having so many little probs that ended up clouding my judgement it led to me not spotting a small error, i had another textbox on the stage in another frame with the var set to txtName, this seemed to be messing it up. Sorry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center