Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error checking a form... 1

Status
Not open for further replies.

colep

Programmer
Jul 18, 2002
58
US
I'm having problems error checking my form that I built in Flash MX... What I basically want it to do it check to see which radio button is check (phone or email) and make sure that the corresponding input box on the form doesn't have a blank entry... If it does have a blank entry, then it is to display an error message. Here's my code that I have placed on the submit button... All the help and feedback would be greatly appreciated!!!!!

Code:

on (release) {
var contact = contact_by.getValue();
if (contact == "email" && email == "") {
failed = "yes";
message = "If you want to be contacted by Email you must enter in an email address.";
gotoAndPlay(1);
}
if (contact == "phone" && phone == "") {
failed = "yes";
message = "If you want to be contacted by Phone you must enter in a phone number.";
}
if (failed != "yes") {
getURL("contact_send.php", "", "POST");
}
}

I'm new to flash actionscript and am not sure if I have everything typed correctly, but the logic is there...

Thanks in advance,
Cole ;)
 
You might be having a problem with the empty string check - a blank textfield in Flash doesn't have a value = "" it is "undefined". The best thing to do here would be to initialise the empty fields by setting their values to "" when they appear on stage, then your code should be fine.
 
Thanks so much for the reminder!!!! I'm so used to programming in php where you don't have to initialize the variables... It was a big help!!! All is working well!!!! :)

Cole ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top