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:

I typed up a version of this example, which just submits via GET back to
itself so you can inspect the resulting URI:

If you type something in the box and either press enter or submit via
the trigger, it's supposed to submit via GET to

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

If you submit via pressing enter, it doesn't submit value1:

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:

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?


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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:55 UTC