[whatwg] Allow <form> as a child of <tbody>

Simon Pieters zcorpan at hotmail.com
Tue Jan 17 15:52:39 PST 2006


Hi,

In the form attribute[1] section in WF2 there is an example that says:

>In this example, each row contains one form. Without the "form"
>attribute, it would not be possible to have more than one form
>per table if any of them spanned cells.

While that is true with the constraints of HTML4, we could allow forms to be 
direct children of <tbody> in HTML5. If we allowed that, the example could 
look like this instead:

<table>
<thead>
  <tr>
   <th>Name</th>
   <th>Value</th>
   <th>Action</th>
  </tr>
</thead>
<tbody>
  <form action="/edit" method="post">
   <tr>
    <td>
     <input type="hidden" name="id" value="1"/>
     <input type="text" name="name" value="First Row"/>
    </td>
    <td>
     <input type="text" name="value"/>
    </td>
    <td>
     <input type="submit" name="Edit"/>
    </td>
   </tr>
  </form>
  <form action="/edit" method="post">
   <tr>
    <td>
     <input type="hidden" name="id" value="2"/>
     <input type="text" name="name" value="Second Row"/>
    </td>
    <td>
     <input type="text" name="value"/>
    </td>
    <td>
     <input type="submit" name="Edit"/>
    </td>
   </tr>
  </form>
</tbody>
</table>

The form="" attribute is not needed in this example. This also happens to be 
backwards compatible with legacy UA's. Is there a reason to disallow this 
sort of nesting?

[1] http://whatwg.org/specs/web-forms/current-work/#formAttribute

Regards,
Simon Pieters





More information about the whatwg mailing list