Thread: alert
View Single Post
  #1 (permalink)  
Old December 28th, 2003, 05:21 AM
collie collie is offline
Authorized User
Join Date: Oct 2003
Location: , , .
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default alert


I am trying to write a function that returns an error message. If the user doesn't enter a valid email then an alert pops up, if the user doesn't enter a phone number then a different alert must appear. The problem is that if the user doesn't enter an email and a number then i don't want to alerts to appear. I want the error messages to appear in one alert. I tried writing the following function but it gives me the error: 'object is empty' and i think it is referring to the line alert(sat)

     function ValidateForm ()
var sat;
    if (document.Form1.txtEmail.value.indexOf("@")==-1)
sat+="Incorrect email"
    return false;

    if (document.Form1.txtMsg.value=="")
sat+="Enter message"
    return false;


Reply With Quote