Reputation: 22720
I am using YUI 2 autocomplete, I have my own web service which provides suggestions.
Whenever user enters " " (space) then suggestions were not displayed. Like if user enters "foo bar
" then suggestion are displayed till "foo
" but once user enters " " then suggestion are not displayed.
I checked the Ajax calls and observed that space is replaced by "%20
". So after space each Ajax call contains "%20
" and that's why no records are retrieved from database.
I tried setting space as delimiter.If we use space as delimiter then it will show suggestions for new term (which user typed after space). Like if you enter "foo bar
" then after space it will show suggestion for "bar
" while I want suggestions for complete "foo bar
" term.
I want to display suggestion for complete term whatever user had typed including space.
Is there any way to handle this in YUI ?
Upvotes: 1
Views: 292
Reputation: 22720
Encoded URL by overriding generateRequest
method and it worked :)
myAutoComp.generateRequest = function(sQuery) {
return "myProject/index.php?query=" + encodeURIComponent(sQuery);
};
Upvotes: 1
Reputation: 1
YUI().use('autocomplete', 'autocomplete-highlighters', function (Y) {
Y.one('#ac-input').plug(Y.Plugin.AutoComplete, {
resultHighlighter: 'phraseMatch',
source: 'your url'
});
});
It works fine for me.
Upvotes: 0