W3C home > Mailing lists > Public > www-forms@w3.org > February 2007

Submit-on-enter example

From: Klotz, Leigh <Leigh.Klotz@xerox.com>
Date: Thu, 15 Feb 2007 09:43:23 -0800
Message-ID: <E254B0A7E0268949ABFE5EA97B7D0CF402C78550@usa7061ms01.na.xerox.net>
To: <www-forms@w3.org>

For many years now, we've had an example of using DOMActivate to submit
on "enter key" in a device-independent way.
Although it's done in a device independent way, for convenience I'll
just refer to the enter key throughout this message.

This example is even written up in Micah Dubinko's book:
http://xformsinstitute.com/essentials/browse/ch10s03.php#ch10-15-fm2xml

I typed up a version of this example, which just submits via GET back to
itself so you can inspect the resulting URI:
http://xformstest.org/klotz/2007/02/return.xhtml

If you type something in the box and either press enter or submit via
the trigger, it's supposed to submit via GET to
http://xformstest.org/klotz/2007/02/return.xhtml?value1=something;value2
=test

Unfortunately, it appears not to work in popular XForms processors.

If you submit via pressing enter, it doesn't submit value1:
http://xformstest.org/klotz/2007/02/return.xhtml?value2=test


Aaron Reed pointed out to me that this is for two reasons:
1. When you press enter, you aren't exiting the form control and the
value doesn't get changed, unless the input is oncremental.
2. Less importantly, the submission spec calls for non-empty values to
be dropped instead of being submitted as empty values.
   (Personally I disagree with this spec language and would have
preferred xsi:nil to apply, but I didn't notice so it's
    probably too late.)

So, here's a version with input/@incremental='true' which does provide
the desired behavior:
http://xformstest.org/klotz/2007/02/return-incremental.xhtml

I don't think there is an event we can dispatch inside the DOMActivate
handler to cause the value to change, but maybe I'm wrong.

Do any XForms processors have a way of interpreting the event sequence
that makes this popular example work as is?

Leigh.


 
Received on Thursday, 15 February 2007 17:44:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:09 GMT