Opened 6 years ago

Closed 6 years ago

Last modified 6 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 6 years ago by rdworth

  • Resolution set to worksforme
  • Status changed from new to closed

comment:2 Changed 6 years ago by scott.gonzalez

  • Milestone changed from TBD to 1.8
  • Priority changed from minor to major
  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Type changed from feature to bug

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

comment:3 Changed 6 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 6 years ago by scott.gonzalez

  • Milestone changed from 1.8 to 1.8.1
  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in 1ddd4f5d3f83e1612cdbcf7039d01619b62c8a05.

You can now do:

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

comment:5 Changed 6 years ago by rdworth

  • Milestone changed from 1.9 to 1.8.1
Note: See TracTickets for help on using tickets.