表单标签不会将元素包含在表格内 [英] Form tag won't enclose elements inside a table
问题描述
我遇到了一个奇怪的问题;我在 <tr>
中有一个表单,但是该表单拒绝在其中包装任何标签.我制作了一个快速的 JSFiddle 这是无效的,所以我的问题是我可以创建一个包含两个或多个 tr
和任意数量的其他元素的表格吗? 表格有其他行它与表单无关,因此将 <form>
放在整个表中是没有帮助的,尽管看到其他行不会有表单的任何输入(POST 请求),我假设一个 form
可以放在整个桌子周围.
哪个是更好的解决方案;全表换行,还是仅将所需行包含在 form
标记中的有效修复?我知道我可以将 table
放在 td > 中.表单
,但是嵌套表中的列宽不会相同,这就是我来问这个问题的原因.
...或... I've run into a curious problem; I've got a form inside a The As can be seen, the Which is a better solution; whole-table wrap, or a working fix for just enclosing the needed rows in a You cannot interrupt the ..or..
这篇关于表单标签不会将元素包含在表格内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! 结构中除了
、
、
、
、 或 >
.你的表单标签需要封装在两个 或者你的整个 需要放在
</表单> 中> 标签.
<tr><td><表格>...表格数据...</表单></td></tr>
<tr>
, however the form refuses to wrap any tags inside it. I've made a quick JSFiddle here to play around with. Firebug reports that the form isn't wrapping anything:<form>
element is greyed out and not wrapping anything. The HTML for this test is below<table>
<form>
<tr>
<td>Input</td>
<td>Another input</td>
</tr>
<tr>
<td colspan="4"><span>Other stuff</span></td>
</tr>
</form>
<tr>
<td>
Rows not affected by the form
</td>
</tr>
<tr>
<td>
Rows not affected by the form
</td>
</tr>
</table>
form
holds two tr
s in the written markup. I read here that this is invalid, so my question is can I create a form that holds two or more tr
s and an arbitrary amount of other elements inside a table? The table has other rows in it not associated with the form, so putting a <form>
round the entire table is unhelpful, although seeing as the other rows won't have any inputs for the form (POST request), I suppose a form
could be put around the entire table. form
tag? I know I could put a table
inside a td > form
, but then the column widths wouldn't be the same in the nested table, which is why I came to ask this question.<table>
structure with any tags besides <thead>
, <tfoot>
, <tbody>
, <tr>
, <th>
, or <td>
. You form tags need to be encapsulated between two <td>
or your entire <table>
needs to be placed within the <form>
tag.<table>
<tr>
<td>
<form>
...form data...
</form>
</td>
</tr>
</table>
<form>
<table>
...
</table>
</form>
登录
关闭