[whatwg] Forms: Submit only changed inputs

2006-02-08 Thread Ric Hardacre
i mentioned this briefly in my introductory email and am interested in 
other people's views.


my thinking is this:

form send=all
default behaviour, implied if send is missing

form send=changed
only send input elements that have changed (i.e. are different to the 
reset state of the form). this would exclude hidden elements, to 
enable the page autor to still track ownership of the form input data.


my reasoning is this:

i'm creating an HTML4 + CSS2 datagrid implimentation, the datagrid is 
quite large and i'm resorting to per-row editing to keep the overhead 
down (both in terms of client scripting and bandwidth). but if a user 
were to load the datagrid and change just on field the entire data set 
would be sent to the server. where one would either (a) validate all the 
data and overwrite the existing data or (b) cache the form info so that 
a quick comparison can be made before validation and db updating.


if, instead you could simply get a set of id's (placed in hidden fields) 
and corresponding data you could just validate and save the changed 
fields with a lot less work e.g.


input type=hidden name=000_id value=123
input type=text name=000_name value=john smith
input type=text name=000_email value=[EMAIL PROTECTED]

input type=hidden name=001_id value=456
input type=text name=001_name value=jane doe
input type=text name=001_email value=[EMAIL PROTECTED]

input type=hidden name=002_id value=786
input type=text name=002_name value=uncle sam
input type=text name=002_email value=[EMAIL PROTECTED]

if the user changes jane doe to janet doe i would recieve back

000_id=123
001_id=456
002_id=789
001_name=janet doe

now i can see that only record 001 has any fields changed, validate 
accordingly, and hence update the name field for user 456.


a non-compliant legacy browser would not see the distinction and send 
all fields, which makes no difference to a good server script as it 
would in effect be performing the (a) option mentioned earlier, only 
that client's response time would be effected.


Ric Hardacre




Re: [whatwg] Forms: Submit only changed inputs

2006-02-08 Thread dolphinling

Ric Hardacre wrote:

...
only send input elements that have changed (i.e. are different to the 
reset state of the form). 


This has been proposed several times and is listed in the For Future 
Versions comments (view the source) at the bottom of the WF2 draft. In 
fact, it's listed twice, once as

 * only submit fields that have changed
and once as
 * A way to include in the submission a list of which form controls
   were changed from their default value.


In terms of the actual proposal you made, what's the point of those 
hidden fields you added? Why can't you just leave them out, so you have


  input type=text name=000_name value=john smith
  input type=text name=000_email value=[EMAIL PROTECTED]

  input type=text name=001_name value=jane doe
  input type=text name=001_email value=[EMAIL PROTECTED]

  input type=text name=002_name value=uncle sam
  input type=text name=002_email value=[EMAIL PROTECTED]

...and when the user changes jane doe to janet doe, you get

  001_name=janet doe

...? Then all you need to do is update the 001_name.




--
dolphinling
http://dolphinling.net/