Defect #11909

Autocomplete results not reset after clearing search field

Added by Jongwook Choi about 9 years ago. Updated almost 9 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:2.1.1
Resolution:Fixed Affected version:2.1.0


Explain for the defect

There are several autocomplete UI's for searching a specific field in redmine;
for example, searching for user (in a modal dialog when adding issue watchers) and for user or group (in the member tab of project settings).

The search result at first show the list of all possible values (to be added),
and when user types a query to search for user (or group), with a delay of 300ms, the search result list shows up with checkboxes.

However, if the search query becomes an empty string,
no ajax request is fired and therefore the list remains to show values the search result for the preivous query, which seems to be quite unnatural.

Is this behavior intended, or is a bug ? For older versions of redmine (e.g. 1.1.x), the search works as I expected.

I think, when query becomes empty, showing up the list identical to the initial list (when query was empty) would be more natural behavior.
That is, the ajax request should be fired even if the query is empty.

About the implementation

Since 2.1, redmine has adopted jQuery, and the cause lies on the function 'observeSearchfield' in /public/javascripts/application.js.

There is an if clause that checks whether query is empty (see source:/trunk/public/javascripts/application.js#L481).
What if it is removed?

Moreover, as far as I know, recent versions (such as 1.4.x and 2.0.x) are affected as well.
Shortly, I will find out patches for the older versions that has another implementation of field observation.

Thank you very much!

application.js-emptyquery.patch Magnifier (1.13 KB) Jongwook Choi, 2012-09-22 19:00

searchfield-empty.png (7.28 KB) Jongwook Choi, 2012-09-22 19:00

Associated revisions

Revision 10527
Added by Jean-Philippe Lang almost 9 years ago

Fixed that autocomplete results are not reset after clearing search field (#11909).

Contributed by Jongwook Choi.


#1 Updated by Jean-Philippe Lang about 9 years ago

  • Subject changed from Searching field (autocomplete) result doesn't show up when search query is empty to Autocomplete results not reset after clearing search field
  • Target version set to 2.1.1

#2 Updated by Jongwook Choi almost 9 years ago

After an inspection, it turns out there is NO problem with redmine 1.4.x and 2.0.x. Affected by turning into jQuery only.

#3 Updated by Jean-Philippe Lang almost 9 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Patch committed in r10527 and merged into 2.1-stable, thanks.

Also available in: Atom PDF