# JS Form validation problem in Mozilla browsers

**URL:** <https://forum.kirupa.com/t/js-form-validation-problem-in-mozilla-browsers/71004>\
**Category:** Uncategorized\
**Created:** [November 19, 2004, 4:37pm UTC](https://forum.kirupa.com/t/js-form-validation-problem-in-mozilla-browsers/71004 "2004-11-19T16:37:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlSieber](https://avatars.discourse-cdn.com/v4/letter/c/f07891/32.png) [@carlSieber](https://forum.kirupa.com/u/carlSieber)\
**Post date:** [November 19, 2004, 4:37pm UTC](https://forum.kirupa.com/t/js-form-validation-problem-in-mozilla-browsers/71004/1 "2004-11-19T16:37:17Z")

</div>

The form validation I put together is failing in Mozilla based browsers (Firefox, NS 7, etc…). It works fine in IE and Safari. Any tips on what I’m doing wrong would be greatly appreciated.

Thanks in advance.  
Carl

The url is:  
[http://www.fd2s.com/MDAC/formTest.html](http://www.fd2s.com/MDAC/formTest.html)

```auto

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Form test</title>
<script type="text/javascript">
	<!-- Begin
	// Error messages
	var dept = "Please select a clinic, department or room name to get your directions.";
	var haveerrors = 0;
	function showText(spanname, newtext, errors) {
	var itemname = eval(spanname);
	itemname.innerText = newtext;
	if (!haveerrors && errors) haveerrors = errors;
	}
	
	function validateForm(theform) {
	haveerrors = 0;
	if (document.theform.destinationID.value=="") {
		showText("depterror", dept, true);
		return (!haveerrors);
		}
	}
	// End -->
	</script>
</head>
<body>
<div id="depterror" class="inlineErrors"></div>
<form name="theform" action="formTest.html">
	<select name="destinationID" size="8">
		<option value="1">One</option>
		<option value="2">Two</option>
		<option value="3">Three</option>
		</select>
	<input name="submit" type="submit" value="Go" onClick="return validateForm(this)">
</form>
	</body>
	</html>

```
