Skip to main content

Bug Tracker

Side navigation

#2404 closed bug (fixed)

Opened February 25, 2008 12:07AM UTC

Closed March 05, 2008 02:48PM UTC

Last modified March 15, 2012 02:08AM UTC

[autocomplete] space does not work as separator for multiple:true

Reported by: ayman Owned by: joern
Priority: major Milestone:
Component: plugin Version:
Keywords: autocomplete, multiple, multipleSeparator Cc:
Blocked by: Blocking:
Description

This is ticket is for the autocomplete plugin at: http://dev.jquery.com/browser/trunk/plugins/autocomplete

When enabling the multiple option and setting the multipleSeparator option to a single space, autocomplete does not work anymore. This setup is quite common for tagging fields, in which you enter multiple tags separated by spaces.

I found the cause of the problem to be the following snippet:

function trimWords(value) {
 if ( !value ) {
   return [""];
 }
 var words = value.split( $.trim( options.multipleSeparator ) );
 var result = [];
 // ...
}

Calling $.trim on options.multipleSeparator removes the space and breaks the functionality of the plugin. This can be fixed by removing the call to $.trim on options.multipleSeparator.

I'm attaching a patch for this.

Thank you.

Attachments (2)
Change History (5)

Changed February 25, 2008 08:54AM UTC by joern comment:1

milestone: 1.2.4
need: ReviewTest Case
owner: → joern
summary: autocomplete plugin does not work with space as a separator[autocomplete] space does not work as separator for multiple:true
version: 1.2.3

Changed February 25, 2008 08:11PM UTC by ayman comment:2

I've attached a test case as requested. Please put jquery.autocomplete.js and its dependencies in the same directory as the HTML file.

To see the bug, type in "java" in the text field and press space, and then type "p" and select "python" from the suggestions. The contents of the field will become "j a v a python" instead of "java python".

If you apply the patch, the problem will disappear.

Changed February 29, 2008 11:14AM UTC by ayman comment:3

[ping]

Any updates? Is there anything else I need to do?

Thanks.

Changed March 04, 2008 08:36PM UTC by DanSwitzer2 comment:4

I've added this patch to the source code.

Changed March 05, 2008 02:48PM UTC by scott.gonzal comment:5

resolution: → fixed
status: newclosed

Fixed in [4862]. Thanks Dan!