Here's the page, the validation is not working:
HTML Code:
<html>
<head>
<script language="JavaScript" type="text/javascript">
function validateComment(timesheet)
{
var Status = document.getElementById('Status').value;
var Comments = document.getElementById('Comments').value;
if(Status=='2' && Comments=='')
{
alert("Please enter a comment for" + document.getElementById('Username').value);
return false;
}
}
</script>
</head>
<body>
<form name="timesheet" method="GET" action="test.html" onsubmit="return validateComment(this)">
<table border="0" id="timesheet">
<tr>
<td>Usernmame</td>
<td>DeviceName</td>
<td>Comment</td>
</tr>
<tr>
<td><input readonly type="text" name="Username_0" size="25" maxlength="25" value="John" /></td>
<td><input type="radio" name="Status_0" id="Status" value="1">Approved <input type="radio" name="radio" id="Status" value="2">Approved with Errors</td>
<td><input type="text" name="Comments_0" size="25" maxlength="25" value="" /></td>
</tr>
<tr>
<td><input readonly type="text" name="Username_1" size="25" maxlength="25" value="Mary" /></td>
<td><input type="radio" name="Status_1" id="Status" value="1">Approved <input type="radio" name="radio" id="Status" value="2">Approved with Errors</td>
<td><input type="text" name="Comments_1" size="25" maxlength="25" value="" /></td>
</tr>
<tr>
<td><input readonly type="text" name="Username_2" size="25" maxlength="25" value="Jim" /></td>
<td><input type="radio" name="Status_2" id="Status" value="1">Approved <input type="radio" name="radio" id="Status" value="2">Approved with Errors</td>
<td><input type="text" name="Comments_2" size="25" maxlength="25" value="" /></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" id="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
Bookmarks