Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-27-2012, 01:55 PM   PM User | #1
brood_snow
New to the CF scene

 
Join Date: Jun 2012
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
brood_snow is an unknown quantity at this point
HTML form question

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">&nbsp;</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!
brood_snow is offline   Reply With Quote
Old 06-27-2012, 02:53 PM   PM User | #2
DrDOS
Senior Coder

 
Join Date: Sep 2010
Posts: 1,146
Thanks: 10
Thanked 148 Times in 148 Posts
DrDOS is infamous around these parts
I've used a hidden input for the isset statement in PhP when I had different forms with different inputs that all submitted to the same page. That way they could all use the same isset statement. But it can be used the other way too, so that you could distinguish between different pages that all use the same basic form. And it may get it's value from some javascript code somewhere else on the page.
DrDOS is offline   Reply With Quote
Reply

Bookmarks

Tags
form, hidden

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:56 AM.


Advertisement
Log in to turn off these ads.