Opened 12 years ago

Closed 12 years ago

#6041 closed bug (notabug)

Change events occur too late due to setTimeout

Reported by: Alien003 Owned by:
Priority: major Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.2
Keywords: blur change click Cc:
Blocked by: Blocking:


I was having problems with the auto-complete and ajax requests on my application.

I have a search button that uses a Ajax request to update the page. To replicate the problem I write the complete/correct text on the auto-complete input and instead of clicking the menu I click the button.

Both the focus and the change events are triggered after the Click event of the button occurs ..and that is kinda too late.

I tracked this problem to the following code:

self.closing = setTimeout(function() {

self.close( event ); self._change( event );

}, 150 );

Is it really necessary to have the _change delayed? It works perfectly if I just leave the close there and do the change right away.

Change History (3)

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

Resolution: invalid
Status: newclosed

The delay is required because of the blur that occurs if you try to click on a menu item. It's also not clear why you care about the change event in cases where you're not even selecting an item from the menu.

comment:2 Changed 12 years ago by Alien003

Resolution: invalid
Status: closedreopened

I want to catch the change event because I don't want to have to actually click on the menu. Example if I just write everything in the input (ignoring the menu), I still want to get the value out of it when I click the button.

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

Resolution: invalid
Status: reopenedclosed

Why does .val() not work for that? That's how you get the value out of a text field, regardless of whether it has autocomplete. If you need to discuss this, please use the forums.

Note: See TracTickets for help on using tickets.