# Testing my Flash form for error input

**URL:** <https://forum.kirupa.com/t/testing-my-flash-form-for-error-input/326333>\
**Category:** flash\
**Created:** [December 7, 2011, 6:39am UTC](https://forum.kirupa.com/t/testing-my-flash-form-for-error-input/326333 "2011-12-07T06:39:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![creativelab](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@creativelab](https://forum.kirupa.com/u/creativelab)\
**Post date:** [December 7, 2011, 6:39am UTC](https://forum.kirupa.com/t/testing-my-flash-form-for-error-input/326333/1 "2011-12-07T06:39:56Z")

</div>

Hello great flash-mates,

I am a newbie still practising “F[COLOR=#696969]orm-2-Email”[/COLOR] kind of code with flash 8 AS2 . But in my case,(using the submit-form method) i am designing a scenerio where the user can request/submit for a **change of password**.

In my code,i have the following textfields as input text boxes -\> _oldpass, newpass,rtnewpass,emailadd_…n finally a dynamic textfield named\* status.text.  
\*my work isn’t ready to run on a (php)server yet.But i have wrtten the codes to make sure the flash form is ready to send variables to Php.

My problem is when i test the flash form,my dynamic text message “ **static.text** ” does not pop out the required “error messages” when users make a wrong entry. i dont know if i have been able to make my question clear enough but here is my code;

\*\*//This is te Function on my AS layer…  
\*\*serverFile = “mail.php”;  
function formValidationChecks() {  
if ((!emailadd.text.length) || (emailadd.text.indexOf("@") == -1) || (emailadd.text.indexOf(".") == -1)) {  
status.text = “Please enter a valid E-mail address”;  
return false;  
} else if (!newpass.text.length) {  
status.text = “Please enter New Password”;  
return false;  
} else if (!rtnewpass.text.length) {  
status.text = “Please Re-Type New Password”;  
return false;  
} else if (!oldpass.text.length) {  
status.text = “Please enter correct Old Password”;  
return false;  
}  
return true;  
}

\*\*//Then the code below,i placed on the submit button to call the above Function…

\*\*on (release) {

status.text = “”;  
if (formValidationChecks()) {  
//filling LoadVars object with variable values  
my\_lv = new LoadVars();  
result\_lv = new LoadVars();  
my\_lv.oldpass = oldpass.text;  
my\_lv.newpass = newpass.text;  
my\_lv.rtnewpass = rtnewpass.text;  
my\_lv.emailadd = emailadd.text;  
trace(my\_lv.oldpass+""+my\_lv.newpass+""+my\_lv.rtne wpass+""+my\_lv.emailadd+"");  
my\_lv.sendAndLoad(serverFile, result\_lv, “POST”);  
// When the results are received from the server…  
result\_lv.onLoad = function(success:Boolean) {  
if (success) {  
oldpass.text = newpass.text=rtnewpass.text=emailadd.text="";  
}  
status.text = result\_lv[“serverResponse”];  
};  
}  
}

HELP ME PLEASE… I dont know why i dont get the error messages whenever i key in the wrong entry.is it a problem with my input text vars? cos i didn’t declare any vars. before writing the AS codes.but i defined the vars. in the property window pane…

Thanks,  
Ojay
