[thelist] Form Submittal on Enter

Andrew Clover and at doxdesk.com
Tue Jan 29 14:54:00 CST 2002


Jeff <jeff at members.evolt.org> wrote:

> this is why it's even more important to use client-side validation to
> improve the user experience.

Agreed.

> furthermore, if you know the first is going to be the default, that's
> easy to account for in the html, whether or not the default one appears
> to be the last on the rendered page.

It's not easy in every case. Vertical positioning is very tricky to hack
this way. For example a common scenario is a shopping cart:

  Product1   qty: [ 1      ]  < Change >
  Product2   qty: [ 2      ]  < Change >

  Address: [ blah blah                 ]

                              < Submit >

Should one enter an address and press enter, the default-button selected
is the first 'Change', of course. It's not really practical to reposition
the buttons in this case, as you won't know how long (in pixels) the form
is going to be.(*)

And also it's a hideous hack of course. ;-)

Still, it's not explicitly documented, and little-known, that the
first button is going to be the default.

> the server-side script or the client-side script?  if it's the server-side,
> how would it know which one was default unless you implicitly coded the
> default in?

That's the idea. At least that way you do get a choice which button to
consider the default. It might be easier to put that information at the
client-side, but neither HTML nor IE's extensions to it currently give us
that ability. (Short of nasty hacks like a hidden first submit button to
swallow enter keypresses.)

>> This would also have matched the established behaviour
>> of passing no pair when submitting a single-text-field
>> form with enter.

> without a submit button of any kind?  or just one single-line text input?

With just one single-line text input and one submit button.

> let's just say i'd rather not cloud the issue with any anti-ms rhetoric.  ;p

MS smell slightly of cabbage! :-p

--
Andrew Clover
mailto:and at doxdesk.com
http://and.doxdesk.com/



More information about the thelist mailing list