[whatwg] Forms: Submit only changed inputs

Ric Hardacre whatwg at cycloid.f9.co.uk
Wed Feb 8 06:07:22 PST 2006


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="john.smith at hotmail.com">

<input type="hidden" name="001_id" value="456">
<input type="text" name="001_name" value="jane doe">
<input type="text" name="001_email" value="janethebrain at hotmail.com">

<input type="hidden" name="002_id" value="786">
<input type="text" name="002_name" value="uncle sam">
<input type="text" name="002_email" value="bigsam101 at gmail.com">

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





More information about the whatwg mailing list