Reputation: 61
Multiple forms in one table, these forms last for varying lengths of rows, however this does not seem to work:
<table>
<form>
<tr>
<td>
</td>
<td>
</td>
</tr>
</form>
<form>
<tr>
<td>
</td>
<td>
</td>
</tr>
</form>
</table>
I believe a table has a definite structure, and this cannot be interlaced with other structures, but is there a tidy work around this?
Thanks.
Upvotes: 6
Views: 7228
Reputation: 115
It would be a problem in all HTML ... including both XHTML and HTML5.
<!ELEMENT table (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
Upvotes: 1
Reputation: 13240
Yes! No problem to HTML5. Now table tags are just a shorthand for table styling rules.
Upvotes: 0
Reputation: 27460
No. According to this document: http://www.w3.org/TR/html401/struct/tables.html#h-11.2.1 table may contain only these:
TABLE --
(CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
But you can use something like this
<div class=table>
<form>
<div class=cell>...</div>
<div class=cell>...</div>
</form>
</div>
with styles:
div.table { display:table; }
div.table > form { display:table-row; }
div.table > form > div.cell { display:table-cell; }
Upvotes: 5
Reputation: 381
There's no real need to have two forms in a single table if you're looking to put them on multiple rows. The bigger the table, the longer it takes for the browser to load and display it. Instead, give each form its own table and place the table tags within the form tags, like so:
<form method="GET" action="foo.sh">
<table>
</table>
</form>
Upvotes: 0
Reputation: 2341
No, you can't do that. I guess you want it that way to have both forms aligned in a table, right?
If you are allowed javascript on the page, you could add the different text boxes etc. inside the <td>
elements, and attach onchange
event handlers to these boxes to populate the corresponding (hidden) fields in your actual forms.
Upvotes: 2
Reputation: 4951
Not between <tr>
tags. They should work outside of <table>
or inside of <td>
though.
Upvotes: 0