Code:
<html>
<head>
<title>Student to search into database</title>
<script language="javascript">
function validate2(objForm){
int k = 0;
if(objForm.name.value.length==0){
objForm.name.focus();
k++;
}
if(objForm.year.value.length==0){
objForm.year.focus();
k++;
}
if(objForm.id.value.length==0){
objForm.year.focus();
k++;
}
if(k == 0){
return false;
}
return true;
}
</script>
</head>
<body bgcolor=#ADD8E6><center>
<form action="FoundStudents.jsp" method="post" name="entry" onSubmit="validate(this)">
<input type="hidden" value="list" name="seek_stud">
<table border="1" cellpadding="5" cellspacing="5" bgcolor = #333366>
<tr>
<td>
<table>
<tr><td colspan="2" align="center"><h2><font color= #FFFF66>Please insert student data</font></h2></td></tr>
<tr><td colspan="2"> </td></tr>
<tr><td><font color= #FFFF66>Name:</font></td><td><input name="name" type="text" size="50"></td></tr>
<tr><td><font color= #FFFF66>Year:</td><td><input name="year" type="text" size="50"></td></tr>
<tr><td><font color= #FFFF66>ID:</td><td><input name="id" type="text" size="10"></td></tr>
<tr><td colspan="2" align="center"><input name= "submit_seek_stud" type="submit" value="Submit"></td></tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
The form works only with the
Code:
<input type="hidden" value="list" name="seek_stud">
. Could someone please explain me why is this line necessary(what does it actually do)? Because I found on Google that
hidden is used only when you submit some information(not visible to the user) in addition to what the user types, and I am not sending such additional information.
Thank you in advance!