Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#5343 closed bug (fixed)

Add option to allow form submission when option is chosen

Reported by: nigel Owned by:
Priority: major Milestone: 1.8.1
Component: ui.autocomplete Version: 1.8rc3
Keywords: keyboard Cc:
Blocked by: Blocking:


Autocomplete prevents form submission when you choose an item with the Enter key. I can understand how this is desirable in many cases, but I happen to have a case where I'd like to immediately submit the form once an option is chosen. Would it be possible to make this behaviour configurable?

Change History (5)

comment:1 Changed 13 years ago by rdworth

Resolution: worksforme
Status: newclosed

comment:2 Changed 13 years ago by Scott González

Milestone: TBD1.8
Priority: minormajor
Resolution: worksforme
Status: closedreopened
Type: featurebug

This is a bug. We're changing the semantics of form elements by canceling the event.

comment:3 Changed 13 years ago by nigel

You can't use the change event either, it fires at all sorts of other times.

I only want to control the handling of the enter key. Not submit the form every time the element changed.

comment:4 Changed 13 years ago by Scott González

Resolution: fixed
Status: reopenedclosed

Fixed in 1ddd4f5d3f83e1612cdbcf7039d01619b62c8a05.

You can now do:

$( el ).autocomplete({
    select: function( event ) {
        if ( event.keyCode === 13 ) {
            // handle enter key selection

comment:5 Changed 13 years ago by rdworth

Note: See TracTickets for help on using tickets.