# How to script a Contact Form success page?

**URL:** https://forum.kirupa.com/t/how-to-script-a-contact-form-success-page/276744
**Category:** flash
**Created:** [December 3, 2008, 6:56am UTC](https://forum.kirupa.com/t/how-to-script-a-contact-form-success-page/276744 "2008-12-03T06:56:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![realdoyle](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@realdoyle](https://forum.kirupa.com/u/realdoyle)
#### Post date: [December 3, 2008, 6:56am UTC](https://forum.kirupa.com/t/how-to-script-a-contact-form-success-page/276744/1 "2008-12-03T06:56:04Z")

</div>

Flash MX/1.0  
I have an almost completely functional Contact Form on a website I am working on. The only issue is that I never get a “success” confirmation in my status box. The status box works great for letting me know when the email address was not entered correctly but I get nothing after hitting the “send” button (though I do get the emails in my inbox).

I would like to add to this code so it will send the user to a “confirmation/success” frame label after hitting the “send” button. Any ideas?

**Here is the script on the “send” button:**  
on (release) {  
status.text = “”;

if(formValidationChecks()){

//filling LoadVars object with variable values  
my\_lv = new LoadVars();  
result\_lv = new LoadVars();

my\_lv.name = name.text;  
my\_lv.phone = phone.text;  
my\_lv.email = email.text;  
my\_lv.message = message.text;

trace( my\_lv.name + " " + my\_lv.phone + " " + my\_lv.email + " " + my\_lv.message);

my\_lv.sendAndLoad(serverFile, result\_lv, “POST”);

// When the results are received from the server…  
result\_lv.onLoad = function(success:Boolean) {  
if (success) {  
name.text = phone.text = email.text = message.text = “”;  
status.text = result\_lv [“serverResponse”];  
}  
};  
}  
}

**Here is the validation script:**  
serverFile = “mail.php”;  
function formValidationChecks(){  
if ((!email.text.length) || (email.text.indexOf("@") == -1) || (email.text.indexOf(".") == -1)) {  
status.text = “Please enter a valid E-mail address”;  
return false;  
} else if (!name.text.length) {  
status.text = “Please enter Your Name”;  
return false;  
} else if (!message.text.length) {  
status.text = “Please Enter Your Message”;  
return false;  
}  
return true;  
}
