I have a form like the one below:
Code:
 
<form action="mailto:a@b.c" method="post" name="entryform" onsubmit="javascript:return validate(entryform)" >
<input type="text" name="yourname" />
<!-- rest of the form here inlcuding submit field -->
</form>
and the javascript function accordingly:

Code:
 
<script language="Javascript">
	function validate(someform) {
		var result=true;
		if (someform.yourname.value == "") {
			alert("Your name, please!");
			someform.yourname.focus();
			return false
		}
                return result;
</script>
It works fine with the function above, but if I use document inside the function, like in the example below, it doesn't work and I would ask if someone has idea why is that (I mean the function doeesn't valide the form, in case when yourname field is left blank in the form.)


Code:
 
<script language="Javascript">
	function validate(someform) {
		var result=true;
		if (document.someform.yourname.value == "") {
			alert("Your name, please!");
			document.someform.yourname.focus();
			return false
                return result;
		}
</script>