Hey all,
I have created a very simple flash guestbook. It actually works, however, I am trying to make it such that if the user DOES NOT input a name, email address, and a comment, then an error message pops up. This the actionscript attached to my submit button. ActionScript 2.0 btw.
So when testing this, I DO get a message saying "Your email address is invalid" if there is nothing inputed anywhere. However, it should say "You should enter your email address!". In fact, before that, it ought to tell me "You should enter your name!" Because if I leave all fields blank, that should be the first error.
Somehow, I have a feeling that the
code is not working. However, the
IS working.
Is there another ActionScript I can use to replace the code that is == null? Is that my problem? Please help, thank you.
I have created a very simple flash guestbook. It actually works, however, I am trying to make it such that if the user DOES NOT input a name, email address, and a comment, then an error message pops up. This the actionscript attached to my submit button. ActionScript 2.0 btw.
Code:
on (release)
{
if (name == null)
{
this.error.gotoAndPlay(2);
this.error.error_message = "You should enter your name!";
}
else if (email == null)
{
this.error.gotoAndPlay(2);
this.error.error_message = "You should enter your email address!";
}
else if (email.indexOf("@", 0) < 0)
{
this.error.gotoAndPlay(2);
this.error.error_message = "Your email address is invalid!";
}
else if (email.indexOf(".", 0) < 0)
{
this.error.gotoAndPlay(2);
this.error.error_message = "Your email address is invalid!";
}
else if (comment == null)
{
this.error.gotoAndPlay(2);
this.error.error_message = "You should leave a comment!";
}
else
{
submit = "yes";
low_num = 0;
high_num = 10;
this.entries = "<b>Thank you " + name + " for your comments!</b><br>Retrieving new entry...";
loadVariablesNum("dguestbook.php", 0, "POST");
this.gotoAndPlay(22);
} // end else if
}
So when testing this, I DO get a message saying "Your email address is invalid" if there is nothing inputed anywhere. However, it should say "You should enter your email address!". In fact, before that, it ought to tell me "You should enter your name!" Because if I leave all fields blank, that should be the first error.
Somehow, I have a feeling that the
Code:
if (name == null)
code is not working. However, the
Code:
(email.indexOf
IS working.
Is there another ActionScript I can use to replace the code that is == null? Is that my problem? Please help, thank you.