Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: Flash Question

  1. #1
    New Coder
    Join Date
    Dec 2009
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Flash Question

    Guys, I am working on the code for a contact form in flash. I don't get any errors, but, I can't get the code to do certain things. The code shows the "thank you for inquiry" within the "status" box but it will not show when an e-mail, name, telephone or comments" are not input. Can someone please tell me what I'm doing wrong? Here's the code. Thanks

    Code:
    bSubmit.onRelease = function()
    {
       email();
    }
    function email()
    {
       
       var sMessage = "Name: " + tName.text + "\nEmail: " + tEmail.text + "\nPhone: " + tPhone.text + "\nComments: " + tComments.text;
       lvSend = new LoadVars();
       lvReply = new LoadVars();
       lvSend.msg = sMessage;
       lvSend.address = "info@test.com"; 
       tName.text = "";
       tEmail.text = "";
       tPhone.text = "";
       tComments.text = "";
       
       lvReply.onLoad()
       status.text = "Sending Message...";
       {
             status.text = "Thank your for your inquiry.";
       }
       lvSend.sendAndLoad('mail.php', lvReply, 'POST');
       
    }
    
    function formValidationChecks(){
    if ((!tEmail.text.length) || (tEmail.text.indexOf("@") == -1) || (tEmail.text.indexOf(".") == -1)) {
    status.text = "Please enter a valid E-mail address";
    return false;
    } else if (!tName.text.length) {
    status.text = "Please enter Your Name";
    return false;
    } else if (!tPhone.text.length) {
    status.text = "Please enter Your Telephone";
    return false;
    } else if (!tComments.text.length) {
    status.text = "Please Enter Your Message";
    return false;
    }
    return true;
    }

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Why would the thank you message show? You are checking to see that the input boxes are filled in. If they aren't then show the text otherwise show the thank you text. Where are you calling formValidationChecks() ? I am guessing it is linked to a button.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Dec 2009
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I rewrote code an now it'll check for the email and name but nothing further and it also won't send. Thanks

    Code:
    Submit.onRelease = function()
    {
      if( formValidationChecks()  == true)  email();
    }

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Your formValidationChecks() function seems a little off. Try using this instead.
    PHP Code:
    function formValidationChecks(){
    if ((
    tEmail.text.length == 0) || (tEmail.text.indexOf("@") == -1) || (tEmail.text.indexOf(".") == -1)) {
    status.text "Please enter a valid E-mail address";
    return 
    false;
    } else if (
    tName.text.length == 0) {
    status.text "Please enter Your Name";
    return 
    false;
    } else if (
    tPhone.text.length == 0) {
    status.text "Please enter Your Telephone";
    return 
    false;
    } else if (
    tComments.text.length == 0) {
    status.text "Please Enter Your Message";
    return 
    false;
    }
    return 
    true;

    Can you post the code form mail.php? Also is mail.php in the same directory as the flash file or is it in the directory that the page that has the flash file is in?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Dec 2009
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here it is. It's still not working..Thanks
    PHP Code:
    <?php


    $to      
    "info@test.com";

    $name $_REQUEST["tName"];
    $email $_REQUEST["tEmail"];
    $telephone $_REQUEST["tPhone"];
    $facility $_REQUEST["tFacility"];
    $comments $_REQUEST["tComments"];




    $mail = new PHPMailer();$mail = new PHPMailer();
    $mail->CharSet ="utf-8"
    $mail->IsSMTP();
    $mail->Host "mail.test.com";
    $mail->From="info@test.com"
    $mail->FromName="My site's mailer";
    $mail->SMTPAuth true;
    $mail->Username "info@test.com";
    $mail->Password "";

    $mail->AddAddress($to);
    $mail->Subject "test Contact Form";
    $mail->Body "Name : " .$tName "\n" "tEmail : " $email "\n" .  "Telephone : " $tPhone "\n" "Facility : " $tFacility "\n" "Comments : " $tComments

    if(!
    $mail->Send())
    {
       echo 
    "Error sending: " $mail->ErrorInfo;
    }
    else
    {
       echo 
    "Thank you for your inquiry.";
       echo 
    '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    }


    ?>

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Where do you include the php mailer class?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    New Coder
    Join Date
    Dec 2009
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks A, but, I scrapped that code and found one working.

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Okay but I'm guessing what you had would have worked fine if you just included the phpmailer class which you never seemed to have done.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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