W3C home > Mailing lists > Public > www-html@w3.org > May 2009

Re: form inside tabular data

From: David Dorward <david@dorward.me.uk>
Date: Mon, 18 May 2009 12:18:20 +0100 (BST)
Message-ID: <38308.132.185.240.121.1242645500.squirrel@malt.us-lot.org>
To: www-html@w3.org
<quote who="Tei">

> you have lots of tabular data, that use <table> <tr> <td>.
> every line on the table is a form
>
> <tr>
> <form><td><input type="text" name="price_21" value="5"
> /></td><td><input type="submit" value="Change price for product 21"
> /></td></form>
> </tr>
>
> Ouch!

It is invalid, but aside from that I see little reason for an "Ouch!". In
this instance, the table looks like it is being used for layout, but I'll
assume that is a simplified example.

> <tr>
> <td><form><input type="text" name="price_21" value="5"
> /></td><td><input type="submit" value="Change price for product 21"
> /></form></td>
> </tr>
>
> Ouch!

This is invalid, but also non-well formed.

> Proposed solution:
> <tr>
> <td><input type="text" form="product_21" name="price_21" value="5"
> /></td><td><input type="submit" form="product_21" value="Change price
> for product 21" /></td>
> </tr>
>
> ...
>
> <form id="producto_21"></form>

Frankly - yuck. I don't see any reason to move the relationship between
forms and form controls from a hierarchy based on one to a attribute
linkage one.

Allowing forms around table rows would (afaik) be backwards compatible
with the error correction in most existing user agents.

> If theres a prefered solution available, whitin the current standards,
> It will be much preferable, but is unknom to me, and to others web
> authors asked about the topic.

One form around the entire table, with the name of the successful submit
button being used to determine which row is being acted upon. (We should
be able to use value, but IE7 and lower have broken implementations of
<button>).

-- 
David Dorward
http://dorward.me.uk/
Received on Monday, 18 May 2009 11:19:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:15 GMT