Function inside "if" statement

Hi guys,

I’ve spent ages on this with no joy, so thought I’d ask here. I’m trying to validate an email form, say thanks if it’s cool, and then after a short delay (so they can read the thanks), go to a frame. This is what I’ve got:

 
on (release) {
if(form.uname_txt.text!="" && form.uemail_txt.text!="[EMAIL="%22%20&&%20form.uemail_txt.text.indexOf(%22@%22,0)%3E0"]" && form.uemail_txt.text.indexOf("@",0)>0[/EMAIL] && form.uemail_txt.text.indexOf(".",0)>0){
 // send variables in form movieclip (the textfields)
 // to email PHP page which will send the mail
 name_txt.text = "name:"
 email_txt.text = "email:"
 ErrorMessage.text = "Thank you!";
 form.loadVariables("email.php", "POST");
  delay=1000;
 function back(){
    _root.gotoAndPlay("back");
    clearInterval(intBack);
 }
intBack=setInterval(back,delay);
}
}

Bear in mind that the validation code works fine, and I’ve cut some of it so you don’t have to read it all :wink:

Anyway, if I get rid of the “if” statement and just have this:

 
on (release) {

 name_txt.text = "name:"
 email_txt.text = "email:"
 ErrorMessage.text = "Thank you!";
 form.loadVariables("email.php", "POST");
  delay=1000;
 function back(){
    _root.gotoAndPlay("back");
    clearInterval(intBack);
 }
intBack=setInterval(back,delay);
}

…it works perfectly, but my validation doesn’t work, obviously. How do I get them both working…?

:slight_smile: