|
I am trying to implement a field validation function:
function validate()
{
var result = true;
var x=document.problem_form.explanation.value;
if ((x==null) || (x.length==0))
{
alert("Please enter an explanation");
result = false;
}
return result;
}
Now if the field is empty, it will display the alert window, but it will also perform the FORM ACTION. I can't figure out why. Is there some special situation that will make it perform the ACTION that I just happen to be in? Any advice would be great.
Thanks,
Jeff Krause
|
|
|
Hi Jeff
You probably need to call the function using return eg.
onsubmit="javascript:return validate()"
that should then pick up the false I think.
Hope that helps
David
|
|
|
|
|
|
|
|