alert
Hi,
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;
}
alert(sat)
else
{
document.Form1.action="card.asp";
}
document.Form1.submit()
}
*/
</script>
|