Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-08-2010, 08:57 PM   PM User | #1
ilouie
New Coder

 
Join Date: Dec 2009
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
ilouie is an unknown quantity at this point
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;
}
ilouie is offline   Reply With Quote
Old 10-10-2010, 06:18 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 10-10-2010, 03:53 PM   PM User | #3
ilouie
New Coder

 
Join Date: Dec 2009
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
ilouie is an unknown quantity at this point
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();
}
ilouie is offline   Reply With Quote
Old 10-10-2010, 04:57 PM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 10-11-2010, 01:55 PM   PM User | #5
ilouie
New Coder

 
Join Date: Dec 2009
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
ilouie is an unknown quantity at this point
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.'">';
}


?>
ilouie is offline   Reply With Quote
Old 10-12-2010, 01:34 AM   PM User | #6
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Where do you include the php mailer class?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 10-12-2010, 12:10 PM   PM User | #7
ilouie
New Coder

 
Join Date: Dec 2009
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
ilouie is an unknown quantity at this point
Thanks A, but, I scrapped that code and found one working.
ilouie is offline   Reply With Quote
Old 10-13-2010, 05:48 AM   PM User | #8
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:52 AM.


Advertisement
Log in to turn off these ads.