Javascript function not working

my javascript function doesn’t run when executed. i have only been checking the first function checkRunnerID. but i wrote the whole lot of code first. i have became to break it down to test. but even the simple function to test for empty string isn’t running. if my simple function isn’t working. im guessing there are many errors in my coding. please help me fix my problem… i have no ideas where i am wrong.

<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"/>
<title>Submit a runner time</title>

<script type ="text/javascript">


function checkRunnerId(){

if(document.getElemenetById('RunnerID').value == "") {
	alert('Please enter a value');
	return false;	
	}
}
function validateEventId(){
var eventId = document.getElemenetByName("EventID")

if(eventId,parseInt() == null){
	alert("please enter a value");
}else{
	if(eventId.parseInt() > 1 && eventId.parseInt() <= 9999){
		alert("please enter a value between 1 and 9999");
	}else{
		return true;
	}
}
}

function validateDate(){
var date = document.getElemenetByName("Date").value;
var dateFormat = ^\d[1-9]{4}+\-/+[1-9]{2}+\-/+[1-9]{2}; 

if(date.parseInt() == null){
	alert("Please enter a Date ");
}else{
	if(date.parseInt().test(pattern)){
		return true;
	}else{
		alert("Please use the format YYYY-MM-DD ");
	}
}
}

function validateFinishTime(){
var time = document.getElemenetByName("FinishTime").value;
var pattern = ^\d[0-9]{2}+\:/+[0-9]{2}+\:/+[0-9]{2};

if(time.parseInt() == null){
	alert("please enter a finishing time ");
}else {
	if(time.parseInt().test(pattern)){
		return true;
	}else{
		alert("Please use the format HH:MM:SS");
	}
}
}

function validatePosition(){
var position = document.getElemenetByName("Position").value;

if(position > 1 && position <= 10000){
	return true;
}else{
	position = -1;

}
}

function validateCatergoryId(){
var catergoryId = document.getElemenetByName("CategoryID").value

if(catergoryId > 1 && catergoryId <= 100){
	return true; 
}else {
	catergoryId = -1;
}
}

function validateAgeGrade(){
var ageGrade = document.getElemenetByName("AgeGrade").value
var pattern = ^\d[0-9]{2}+.+\d[0-9]{2};

if(ageGrade.parseInt().test(pattern)){
	return true;
}else{
	ageGrade = -1;
}

}

function validatePb(){
var pb = document.getElemenetByName("PB").value

if(pb === 0){
	return true;
}else{
	pb = -1;
}
}
</script>

</head>
<body>
<hr/>
<h1>Submit a runner time</h1>
<hr/>
Note: all fields marked '*' are mandatory.
<p/>
<form action="#"
  method="post" name="submitrunnertime" onsubmit="return checkRunnerId()">
<table>
<tr><td>Runner ID*</td>
<td><input type="text" id="RunnerID" name="RunnerID" size="4"            maxlength="4"/></td>
</tr>
<tr><td>Event ID*</td>
<td><input type="text" name="EventID" size="4" maxlength="4"/></td>
</tr>
<tr><td>Date (YYYY-MM-DD)*</td>
<td><input type="text" name="Date" size="10" maxlength="10"/></td>
</tr>
<tr><td>Finish time (HH:MM:SS)*</td>
<td><input type="text" name="FinishTime" size="8" maxlength="8"/></td>
</tr>
<tr><td>Position</td>
<td><input type="text" name="Position" size="5" maxlength="5"/></td>
</tr>
<tr><td>Category ID</td>
<td><input type="text" name="CategoryID" size="3" maxlength="2"/></td>
</tr>
<tr><td>Age grade</td>
<td><input type="text" name="AgeGrade" size="5" maxlength="5"/></td>
</tr>
<tr><td>Personal best</td>
<td><input type="text" name="PB" size="1" maxlength="2"/></td>
</tr>
</table>
<input type="submit" name="submitrunnertime" value="submit"/>
<hr/>
</form>
</body>
</html>

getElemenet should be getElement

1 Like

oh…hang my head in shame for that one … i’m still big time newbie
any other issues or simplifications that you can point out ?

Should be eventId.parseInt()