PDA

View Full Version : data validation, urgent help



mprzybylski
November 19th, 2004, 01:49 PM
hello
i have set up a data validation file in fmx and when the data is valid i want it to go and play the "preview" frame, but if it is not valid i want it to stay on that frame until the person edits it to be valid. i attached the file and can't figure out why my code is not working. any help would be greatly appreciated as i need this done ASAP.

thanks in advance.

luth
November 19th, 2004, 02:43 PM
Try moving the hide call on your preview button and don't forget the double ='s on the if statement:

preview_btn.onRelease = function() {
validateName();
validateEmail();
// hide();
if (success == true) {
gotoAndStop("preview");
hide();
}
msg = message_mc.message_txt.text;
};

mprzybylski
November 19th, 2004, 02:54 PM
thanks a ton!

aknatn
November 19th, 2004, 03:03 PM
My suggestions:

Start off by dumping the preview ability and by getting your script to run properly.

Delete all AS on frame 2 of the maintime line.

Add this action script to the send button instead:

on (release) {
if (!_root.message_mc.name1_txt.length) {
valid_txt.text = "Please enter a name.";
}else if(!_root.message_mc.name2_txt.length) {
valid_txt.text = "Please enter a receiving name.";
}else if (!_root.message_mc.email1_txt.length || message_mc.email1_txt.indexOf("@") == -1 || message_mc.email1_txt.indexOf(".") == -1) {
valid_txt.text = "Please enter a valid email.";
}else if (!_root.message_mc.email2_txt.length || message_mc.email2_txt.indexOf("@") == -1 || message_mc.email2_txt.indexOf(".") == -1) {
valid_txt.text = "Please enter a valid email.";
}else if (!_root.message_mc.message_txt.length) {
valid_txt.text = "Please fill the message field.";
}else{
loadVariablesNum ("http://www.yourhost.com/to/your/script.php", "0", "Post");
}
}

Examine the way I have validation done here, much more efficient.

mprzybylski
November 19th, 2004, 04:40 PM
thanks! i looked at a file i had done from home and i had the same setup almost as you for my validation so i rewrote it like that. again, thanks for helping out when in need.