I am having a problem with a simple javascript validation routine for a drop-down list, which works fine when there is only one form on the web page, but breaks when another form is added. I am new to javascript, so I expect this is a simple error in syntax.

When there was only one form on the page:

It was called by:

<form method="post" action="path-to-cgi formmail script" onsubmit="return checkForm(this)">

and the javascript routine, in the head of the document, was:

<script type="text/javascript">
<!--
function checkForm(form) {
if (form.realname.value == "") {
alert("Please enter your name.");
form.realname.focus();
return false;
}

if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value)){
alert("Invalid E-mail Address! Please re-enter.");
form.email.select();
form.email.focus();
return (false);
}

var txt=form.classmatch.options[form.classmatch.selectedIndex].text;
if (txt == "To Specify...") {
alert("Please select the class match that you would like to play.");
form.classmatch.focus();
return false;
}

return true;
}
//-->
</script>

and it worked fine.

A second form was added, and the forms given names. The javascript validation for the form with the drop-down (option) list works for the fields prior to the drop-down list, but then fails when it validates the drop-down - it passes through, failing to recognise when no selection has been made. The second form validates fine.

The first form, with the drop-down list, is called by:

<form name="request" id="request" method="post" action="path-to-cgi formmail script" onsubmit="return checkForm(request)">

The second form (without a drop-down list), is called by:

<form name="result" method="post" action="path-to-cgi formmail script" onclick="return checkForm(result)">

The javascript routines, again in the head of the page are:

<script type="text/javascript">
<!--
function checkForm(request) {
if (request.realname.value == "") {
alert("Please enter your name.");
request.realname.select();
request.realname.focus();
return false;
}

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(request.email.value)){
return (true);
}
alert("Invalid E-mail Address! Please re-enter.");
request.email.select();
request.email.focus();
return (false);
}


var txt=request.classmatch.options[request.classmatch.selectedIndex].text;
if (txt == "Choose Your Event") {
alert("Please select the class match that you would like to play.");
request.classmatch.focus();
return (false);
}

return true;
}
//-->
</script>

<script type="text/javascript">
<!--
function checkForm(result) {

if (result.realname.value == "") {
alert("Please enter your name.");
result.realname.focus();
return false;
}

if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(result.email.value)){
alert("Invalid E-mail Address! Please re-enter.");
result.email.select();
result.email.focus();
return false;
}

if (result.event.value == "") {
alert("Please enter the event name and number, as it appears in the PGN header.");
result.event.focus();
return false;
}

if (result.pgn_record.value == "") {
alert("Please paste in the full record of your game.");
result.pgn_record.select();
result.pgn_record.focus();
return false;
}

return true;
}
//-->
</script>

I am making a fundamental error somewhere, but I can't see it. I'd be grateful for some advice to get it working.

Many thanks
Alan