Hi Scholars,
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.rtnewpass+""+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