#2404 closed bug (fixed)
[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 (7)
Changed 15 years ago by
Attachment: | autocomplete.patch added |
---|
comment:1 Changed 15 years ago by
Milestone: | 1.2.4 |
---|---|
need: | Review → Test Case |
Owner: | set to 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 15 years ago by
Attachment: | autocomplete-testcase.html added |
---|
comment:2 Changed 15 years ago by
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.
comment:5 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in [4862]. Thanks Dan!
Test case