Hi All
I’ve created a form which validates a form, and shows an error if theres a problem.
I want to check that the email address is the correct format, and also that the phone number contains only numbers.
This is my button code which works fine except for the email checking, and there is no number checking…HELP PLEASE!
// checks to see if any REQUIRED fields are empty - WEAV 2005
this.contactForm.submitBtn.onRelease = function(){
source = contactForm.userInterest.getValue();
if (!contactForm.userName.length) {
error.errortxt.error = “Please enter your Name”;
tellTarget (“error”) {
gotoAndPlay(1);
}
} else if (!contactForm.userTelno.length) {
error.errortxt.error = “Please enter your Telephone Number”;
tellTarget (“error”) {
gotoAndPlay(1);
}
} else if (!contactForm.userEmail.text || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
error.errortxt.error = “Your Email Address is incorrect”;
tellTarget (“error”) {
gotoAndPlay(1);
}
} else if (!contactForm.userCompname.length) {
error.errortxt.error = “Please enter your Company Name”;
tellTarget (“error”) {
gotoAndPlay(1);
}
} else if (!contactForm.userAddress.length) {
error.errortxt.error = “Please enter your Company Address”;
tellTarget (“error”) {
gotoAndPlay(1);
}
} else if (!contactForm.userInterest.length) {
error.errortxt.error = “Please tell us your area of interest”;
tellTarget (“error”) {
gotoAndPlay(1);
}
} else {
sendForm();
gotoAndStop (“FormConfirm”);
}
//END - PROCESS FORM (PRESSING SUBMIT BUTTON) //END - PROCESS FORM (PRESSING SUBMIT BUTTON)
}