#6147 closed bug (fixed)
Autocomplete: Errors on empty responses
Reported by: | clewis | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.8.6 |
Component: | ui.autocomplete | Version: | 1.8.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
PROBLEM: When the source is a service and it returns an empty response body, a javascript error occurs. Some service languages, such as .net, will return an empty body when the request is terminated mid stream, such as pressing enter in the text box too fast before the suggestions are displayed.
CAUSE: The response handler does not check to see if the content parameter is null before attempting to check its length.
WORKAROUND: override the response handler in the following manner to mitigate the issue:
$.ui.autocomplete.prototype._response = function( content ) { if ( content && content.length ) { content = this._normalize( content ); this._suggest( content ); this._trigger( "open" ); } else { this.close(); } this.element.removeClass( "ui-autocomplete-loading" ); };
Change History (3)
comment:1 Changed 12 years ago by
Milestone: | TBD → 1.9 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Summary: | "content is null" javascript error when source service returns empty response body → Autocomplete: Errors on empty responses |
comment:2 Changed 12 years ago by
Milestone: | 1.9 → 1.8.6 |
---|
comment:3 Changed 12 years ago by
Autocomplete: Make sure we have a response before trying to check the length. Fixes #6147 - Autocomplete: Errors on empty responses.
Changeset: a5c119558b0b40633269c7565339e5b20754c3d8
Fixed in a5c1195.