Forum Moderators: open
I was wondering if I have to use the <form name="name" method="method" action="action"></form> tag inside each cell, or just at the beginning of the page where I start inserting the form tags, and at the bottom of the page after the last form tag?
There will be other parts of the page in between the <select></select> values where it is strictly HTML, and is not part of the form.
If I do use the <form> tag at the beginning and end of each value, do I use the same <form name="">?
<form name="name" method="method" action="action">
which is at the top of the page, or at least before the first form tag.
And all of the form tags have just the following:
<form><formtag>form tag elements</formtag></form>
And then you have the closing </form> after the last tag.
And by the way, how does the reset button work? I have inserted it with the following code, but it does not work:
<form><input type="reset" name="Clear Form"></form>
What's missing?
<form name="form1" method="post" action="whatever">
<input type="text" name="textfield1">
<br>
<input type="text" name="textfield2">
<br>
<input type="text" name="textfield3">
<br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
Should I just have one opening form tag at the top of the page:
<form name="name" method="method" action="action">
and one closing one
</form>
at the bottom of the page, and none after each form element (<select></select>), even though there are elements in the page that are not form related?
<edit>Scratch that thought...doesn't work...you need the <form> tag before and after each element in the form</edit>
[edited by: LABachlr at 3:31 am (utc) on Sep. 24, 2003]
As the two previous posters have said; you only use one set of <FORM></FORM> tags. You DO NOT wrap each individual element with <FORM></FORM> tags.
As for the reset button. It will work with <SELECT>s, but I'd imagine you'd have to specify a default setting such as:
<OPTION VALUE="myvalue" SELECTED="SELECTED">
Here is how the page is setup. It it one big table with 244 rows and 5 columns. Columns 1 and 5 are empty. Columns 2 and 3 contain plain text (Col. 2 is the quantity of the item, and Col. 3 is the description of the item). Column 4 is the column that has all of the <select></select> tags so that the visitor can chose how many of each item they would like included in their submission.
I removed all of the form tags that were wrapped around each individual form element. No problems there. However, placing the <form></form> tags is what's creating the problem.
When I place the <form name="name" method="method" action="action"> tag right above the first <select> tag for the first form element in the same cell as the element, it acts as if there is no close form tag(</form>), and the form tag coding actually appears on the page. This happens even though there is a close form tag (</form>) after the last form element in the form at the bottom of the form. My guess is that it is because the close form tag is in a different cell then the open form tag.
I have even tried placing the <form> tags in empty cells at the top and bottom of the page, but it's still a no go. I also tried placing the open form tag above and outside of the large table, and the close form tag below and outside of the large table, but that does not work either.
Any thoughts on this one?
Yes, defanjos's example does work. But that is because none of the elements are in different cells in a table.
<form name="form1" method="post" action="whatever">
<table>
<tr>
<td><input type="text" name="textfield1"></td>
<td><input type="text" name="textfield2"></td>
<td><input type="text" name="textfield3"></td>
</tr>
</table>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form> that's how i recall doing it way back when...
ummm... don't put the <form> </form> tags in the table cells...
Very cool. Thanks. The page has more tables than just the main one, so I tried putting the <form> tag right after the <div> tag at the top of the page, and the </form> tag right before the </div> tag at the bottom of the page, and everything is good to go! Even the reset button works!
Thanks!
that's how i recall doing it way back when...
LOL. Way back when? What do you use now? CSS? PHP?