Opened 13 years ago

Closed 12 years ago

Last modified 10 years ago

#5928 closed bug (notabug)

When a user selects an item in the autocomplete dropdown list, the order of events being fired has change from version 1.8.2

Reported by: dhopman Owned by:
Priority: major Milestone:
Component: ui.autocomplete Version: 1.8.4
Keywords: Cc:
Blocked by: Blocking:


In version 1.8.2 the autocomplete select event would fire before the focus event fires on the control itself.

In version 1.8.4 the focus event on the control fires before the before the select event fires.

This causes issues, when needing to know what data was selected on the focus event of the control itself, since the select has not fired yet.

Change History (5)

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

Why are you trying to use the focus event to figure out what item was selected?

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

Resolution: invalid
Status: newclosed

comment:3 Changed 12 years ago by ekkis

there is a valid use case for the behaviour in 1.8.2, which I believe to be more correct than that in 1.8.4 - if I need to insert a database record on the back only when the user has NOT picked a value from the autoselect list, the place to do it is in the /focusout/ event. If the /select/ event fires before /focusout/ does I get the chance to set a flag indicating a selection has been made (and therefore the entry already exists in the database). Therefore, when the user leaves the field, I can decide to insert a record on the basis that a value NOT picked from the autocomplete is being entered.

If you reverse the order of events, I'm out of luck.

In fact, clicking on the autocomplete list should not fire a /focusout/ event at all because the user is not really leaving the field, he's merely using a built-in mechanism for completing his entry.

so how is it now recommended we accomplish the above?

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

Use the change event, which will tell you if a valid item was chosen (ui.item will exist).

comment:5 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.