[development] Form API and enter key press

Pierre Rineau. pierre.rineau at makina-corpus.com
Mon Mar 8 08:55:29 UTC 2010

On Wed, 2010-03-03 at 14:55 -0500, Andrew Berry wrote: 
> On 2010-03-03, at 6:01 AM, Pierre Rineau. wrote:
> > Found my own solution, a jQuery based script that searchs for a specific
> > class on form input elements and trick the browser by preprending a
> > cloned version of the default submit button on top of the form.
> When I've dealt with this in the past, I've caught the input event and fired the appropriate action. How does that compare to your solution?
> --Andrew

I read some posts saying that catching the enter key can be hard to do
with some browsers. I finally choose another solution: copying the
default button DOM element on top of the form, but hidden in order to be
fully transparent for the end user. It seemed to be the nicest solution
because it does not requires your javascript to add any events on
buttons and it let the browser do its job.

See http://drupal.org/project/default_submit


More information about the development mailing list