W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2007

[whatwg] additional key attribute in form field

From: Krzysztof Żelechowski <giecrilj@stegny.2a.pl>
Date: Sat, 7 Jul 2007 17:40:52 +0200
Message-ID: <200707071740.52801.giecrilj@stegny.2a.pl>
Dnia pi?tek, 6 lipca 2007 13:32, Alexander napisa?:
> Greetings,
> i wonder why there's still no a special 'key' attribute for every form
> field implemented.
> Let's say I have rendered table from query result and one column could be
> updateable via text field. And let's say record id field is
> uniqueidentifier (not integer). I'd like to write the following:
> <form ...>
> !--- Loop query results ---!
> <input type="text" key="{id_value_here}" name="quantity" value="">
> ....
> <input type="text" key="{id_value_here}" name="quantity" value="">
> !--- End of loop ---!
> </form>
> and
> when submitting the form and checking results on server, I'd like to know
> the 'owner' of every quantity field:
> !--- loop via quantity fields ---!
> if (quantity.key == 'XXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX') { ... }
> !--- end of loop ---!
> Regards,
> Alexander.

1. Your code is old-fashioned: the identifier should be used instead of the 
2. The identifier should be unique throughout the document so your code will 
be ill-formed.

If I understand your intention correctly, you want to submit an entire table 
instead of just one record a time; HTML forms clearly were not designed with 
that application in mind.  I think you would be better off by performing an 
internal query on the client side---where you can refer to the form fields by 
numeric index rather than by identifier---and reformatting it to JSON before 
submission.  If this is impossible, you could make a round trip to the server 
for each record.  My experience shows that it is often the case with current 

Received on Saturday, 7 July 2007 08:40:52 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:57 UTC