A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with Contact Form

  1. #1
    Junior Member
    Join Date
    May 2007
    Posts
    23

    Unhappy Help with Contact Form

    I have a contact form in my website that sends email out even if not all the fields are filled in. I need to change it so that it will only proceed if all fields are filled in.

    This is what I have right now:

    on (release) {
    // send variables in form movieclip (the textfields)
    // to email PHP page which will send the mail
    form.loadVariables("email.php", "POST");
    }



    This is what I found online:

    on (release) {
    if (form.name_txt.text == "" || form.email_txt.text == "" || form.body_txt.text == "") {
    // do whatever. one of the textfields is empty
    } else {
    form.loadVariables("send.php", "POST");
    play();
    }
    }


    I spent over two hours trying to implement this into my website (n00b ) but I can't get it to work. I've had all kinds of problems. Sometimes it seems like it won't send the email but then when I upload it and try it out online it does!

    Thanks!
    Last edited by codeoverride; 10-01-2009 at 04:30 PM.

  2. #2
    Junior Member
    Join Date
    May 2007
    Posts
    23
    Oh.. sorry, this is what my latest attempt looks like:

    on (release) {
    if (form.name_txt.text == "" || form.email_txt.text == "" || form.message.text == "") {
    gotoAndStop(7);
    } else {
    form.loadVariables("email.php", "POST");
    }
    }


    It still sends the message. Even if not all fields are filled out.
    Last edited by codeoverride; 10-01-2009 at 04:35 PM.

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    You're going to have to sey these initial values to your textfields first.

    So, in form's 1st keyframe, write:
    PHP Code:
    name_txt.text "";
    email_txt.text "";
    message.text ""
    then your comparison will be valid.

    gparis

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