Re: [whatwg] additional key attribute in form field

2008-10-29 Thread Ian Hickson
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.   `._.-(,_..'--(,_..'`-.;.'

Re: [whatwg] additional key attribute in form field

2007-07-07 Thread Krzysztof Żelechowski
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 == '----') { ... }
 !--- end of loop ---!

 Regards,
 Alexander.

1. Your code is old-fashioned: the identifier should be used instead of the 
name.
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 
implementations.

Chris


Re: [whatwg] additional key attribute in form field

2007-07-07 Thread carmen
  i wonder why there's still no a special 'key' attribute for every form
  field implemented.

 1. Your code is old-fashioned

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...


the idea is making the baseline form field not require hacks..


[whatwg] additional key attribute in form field

2007-07-06 Thread Alexander
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 == '----') { ... }
!--- end of loop ---!

Regards,
Alexander.

Re: [whatwg] additional key attribute in form field

2007-07-06 Thread Alexey Feldgendler

On Fri, 06 Jul 2007 13:32:17 +0200, Alexander [EMAIL PROTECTED] wrote:

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 == '----') { ... }
!--- end of loop ---!


The simple name/value pairs that form submission is organized in are  
sufficient for expressing data structures of any complexity.  
Multidimensional keys like (name, key) in your example can be expressed  
through combined names:


input type=text name=quantity:{id_value_here} value=


--
Alexey Feldgendler [EMAIL PROTECTED]
[ICQ: 115226275] http://feldgendler.livejournal.com


Re: [whatwg] additional key attribute in form field

2007-07-06 Thread Alexander
  The simple name/value pairs that form submission is organized in are  
  sufficient for expressing data structures of any complexity.  
  Multidimensional keys like (name, key) in your example can be expressed  
  through combined names:

  input type=text name=quantity:{id_value_here} value=

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)

Re: [whatwg] additional key attribute in form field

2007-07-06 Thread Alexey Feldgendler

On Fri, 06 Jul 2007 14:07:10 +0200, Alexander [EMAIL PROTECTED] wrote:


  The simple name/value pairs that form submission is organized in are
  sufficient for expressing data structures of any complexity.
  Multidimensional keys like (name, key) in your example can be expressed
  through combined names:

  input type=text name=quantity:{id_value_here} value=

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)


Changing the form submission formats (that currently only allow for  
name/value pairs) is out of scope for WHATWG.



--
Alexey Feldgendler [EMAIL PROTECTED]
[ICQ: 115226275] http://feldgendler.livejournal.com