I think this is a really quick question - and would appreciate any help…
I have the following simple form vaidation script on a [classic] ASP page:
<script>
function validateForm(frm)
{
if(frm.subject.value=="")
{
alert('You must provide a subject.');
frm.subject.focus;
return false;
}
if(frm.message.value=="")
{
alert('You must provide a message.');
frm.message.focus;
return false;
}
frm.submit();
}
</script>
I want to add one more validation
at the beginning of the script,
just to slow down spam bots:
I couldn’t get it to work exactly the way you described:
if (frm.foo.value != “” || frm.foo.length != 0)
The form wouldn’t submit (or maybe just didn’t validate?)
But when I eliminated the || check for !=0 like this:
if (frm.foo.value != “”)
it appears to work. Thank you!
(any idea on how to add back in the check for !=0 ??)
Can you show us more of the page please? Specifically your code In Context with the rest of the page, including your HTML form? (Delete or mask anything sensitive or personal).
(To me it looks like you’re trying to mix Javascript and ASP).