hcl-bot
1
Hi everyone!
The following Javascript code (in the onSubmit event) is not working, and I don’t know why:
var field = document.forms[0].elements(“DeptPhone”).value;
if(field=“”)
{
alert(“You must enter value to DeptPhone!”);
return false;
}
return true;
Any ideas?
hcl-bot
2
Subject: onSubmit JavaScript not working - why?
hi…
the basic error you are doing is in the if clause “=” in javascript is an assignment operator you should use “==”
eg:
var field = document.forms[0].elements.(“DeptPhone”).value;
if(field == “”)
{
alert(“You must enter value to DeptPhone!”);
}
cheers…
kaushik das
hcl-bot
3
Subject: Re: onSubmit JavaScript not working - why?
WOW! Thanx 