I'v code that checking for your form.
How's works?
- When input text was emptied or up to you(you said s/he must enter text more than the value or anything else).
- When it was worked, the message will show under input box.
CODE
// java script for checking form.
<script type="text/javascript">
<!--
function checkValidable() {
var check = 0;
var v1 = document.loginForm.Name.value.length;
var v2 = document.loginForm.StID.value.length;
if (v1 < 1) {
check = 1;
note1.style.display = ''; // show Name's warning
}
else {
note1.style.display = 'none'; // hide Name's warning
}
if (v2 < 1) {
check = 1;
note2.style.display = ''; // show StID's warning
}
else {
note2.style.display = 'none'; // hide StID's warning
}
if (check) {
return false;
}
else {
return true;
}
}
//-->
</script>
// begin forn
<form action="" name=loginForm onSubmit="return checkValidable()">
<table>
<tr>
<td>Name</td>
<td>
<input type=text size=20 name=Name>
<div id=note1 style="display: none; color: red">Please Enter Your Name</div> // show when invalid input
</td>
</tr>
<tr>
<td>Student ID</td>
<td>
<input type=text size=20 name=StID>
<div id=note2 style="display: none; color: red">Please Enter Your ID</div> // show when invalid input
</td>
</tr>
<td></td>
<td>
<input type=submit name=submit value="Submit">
</td>
</tr>
</form>
// end form
Hope you will enjoy
P.S. However you can't rely on the checking from computer's user.

