Ticket #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: | |
| Blocking: | Blocked by: |
Description
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
comment:1 Changed 3 years ago by rdworth
- Status changed from new to closed
- Resolution set to worksforme
comment:2 Changed 3 years ago by scott.gonzalez
- Priority changed from minor to major
- Status changed from closed to reopened
- Type changed from feature to bug
- Resolution worksforme deleted
- Milestone changed from TBD to 1.8
This is a bug. We're changing the semantics of form elements by canceling the event.
comment:3 Changed 3 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 3 years ago by scott.gonzalez
- Status changed from reopened to closed
- Resolution set to fixed
- Milestone changed from 1.8 to 1.8.1
Fixed in 1ddd4f5d3f83e1612cdbcf7039d01619b62c8a05.
You can now do:
$( el ).autocomplete({
select: function( event ) {
if ( event.keyCode === 13 ) {
// handle enter key selection
}
}
});
Note: See
TracTickets for help on using
tickets.


Use the change event http://docs.jquery.com/UI/Autocomplete#event-change