Skip to main content

Search and Top Navigation

#6041 closed bug (notabug)

Opened September 09, 2010 06:01PM UTC

Closed September 10, 2010 03:17PM UTC

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.

Attachments (0)
Change History (3)

Changed September 09, 2010 06:05PM UTC by scottgonzalez comment:1

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.

Changed September 10, 2010 02:59PM UTC by Alien003 comment:2

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.

Changed September 10, 2010 03:17PM UTC by scottgonzalez comment:3

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.