Forum Moderators: open

Message Too Old, No Replies

Stupid question - where to open and close form tags

with tables open close forms

         

salewit

10:56 pm on Nov 2, 2008 (gmt 0)

10+ Year Member



I'm very confused about the correct placement of FORM tags within tables. Whenever I try to validate my code, I inevitably get told I can't put the form tags where I put them. Is there clarification on this? Here's an example which I know probably isn't correct. Aside from the "Why are you even using tables response", where would I open and close the tags for this one?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<form action="go_HERE.php">
<table>
<tr><td><input type="text" name="foo1" /></td></tr>
</form>
<form action="go_THERE.php">
<tr><td><input type="text" name="foo2" /></td></tr>
</table>
</form>

tangor

12:24 am on Nov 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You show two forms in a table.

<table>
<tr>
<td><form></form></td>
</tr>
<tr>
<td><form></form></td>
</tr>
</table>

salewit

2:35 am on Nov 3, 2008 (gmt 0)

10+ Year Member



Ok, but nothing is ever that simple (right?)... can it overlap or do I somehow need to do all my form work in ONE ROW? Maybe a table within a row? Is the simple rule that a form must open and close in a row? Ok to overlap multiple rows?

<table>
<tr>
<td><form></td>
<td></form></td>
</tr>
<tr>
<td><form></td>
<td>More stuff</td>
</tr>
<tr>
<td>Another row</td>
<td></form></td>
</tr>
</table>

salewit

2:36 am on Nov 3, 2008 (gmt 0)

10+ Year Member



Sorry... forgot to put that in code tags.

tangor

5:43 am on Nov 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The form tag can include an entire table, or be contained inside table cells.

If each form (you are showing two) is complete, why don't you div them independently?

<div><form></form></div>
<div><form></form></div>

You'll need to provide more info... are these intended for navigation or a select list?

tedster

6:52 am on Nov 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok to overlap multiple rows?

It's not OK to overlap any elements like that - it's a nesting error. If you open element B after element A, then you need to close element B before your close element A

tangor

9:52 am on Nov 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



tedster...

Thank you. I forgot the cardinal rule "never assume"...

Yes... watch for nesting errors salewit. That's what the piddling replies sent were meant to illustrate.