[whatwg] additional key attribute in form field
Ian Hickson
ian at hixie.ch
Tue Oct 28 23:28:41 PDT 2008
On Fri, 6 Jul 2007, Alexander wrote:
>
> i wonder why there's still no a special 'key' attribute for every form
> field implemented.
Basically the answer is because it can already be done with "name".
On Fri, 6 Jul 2007, Alexander wrote:
>
> Of course, it's how I usually do this :) But I would not be against some
> common specified approach - especially taking into consideration some
> restriction on 'name' symbolset (there are much less restrictions on
> 'value' symbolset)
We've expanded name="" in HTML5 to allow basically any value.
On Fri, 6 Jul 2007, Alexey Feldgendler wrote:
>
> Changing the form submission formats (that currently only allow for
> name/value pairs) is out of scope for WHATWG.
That's not the case (indeed we had an XML format for a while), but I don't
think it's necessary in this case anyway.
On Sat, 7 Jul 2007, Krzysztof Żelechowski wrote:
>
> 1. Your code is old-fashioned: the identifier should be used instead of
> the name.
It's not old-fashioned, these techniques are all valid techniques. Let's
avoid putting down each other's conventions.
> 2. The identifier should be unique throughout the document so your code
> will be ill-formed.
He was making up his own markup proposal, so there's no way to know if
this is true or not. It appears you are making assumptions about his
proposal here that are not warranted.
> 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 implementations.
That seems overly complicated; I would recommend using a key exactly as
the original poster attempted, but simply using the name field and
separating the key from the field name with a punctuation character.
On Sat, 7 Jul 2007, carmen wrote:
>
> old-fashioned or not, the reality is most popular web frameworks are
> using regex hacks on the name field to squish more information in there.
>
> <input name="user[35][name]" value="Emmanuel">
>
> it might be worth considering how they could use normal form fields
> without Javascript, and not require Regex in multiple places along the
> line. obviously another workaroudn besides regex is custom serialization
> and nonstandard attribute names of the input element - my preference
> using RDFa style predicates to describe what the field actually
> contains...
Different people have different needs. I wouldn't characterise the use of
a convention for naming input controls as a hack. Also, this shouldn't
require JavaScript, it can be purely server-side logic.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list