BUG-15608 Suggest field doesn't display the suggestion list in the third letter.
A suggest field with the type of search: "Result that contain the entered text", in the third letter that is enter the suggestion list is not displayed. The problem whit the suggestion field was in a js validation, when the function indexOf() was used to return the position of the string that was search, this was happening because the validation was comparing with '0' when the string was not found, when this function returns -1 and not 0 if the item is not found, 0 was the initial position in the string.
This commit is contained in:
@@ -1525,7 +1525,7 @@ return 0;_b.DOM.remE(this.idAs);this.sInp=val;if(val.length<this.oP.minchars)
|
||||
{this.aSug=[];this.nInpC=val.length;return 0;}
|
||||
var ol=this.nInpC;this.nInpC=val.length?val.length:0;var l=this.aSug.length;if(this.nInpC>ol&&l&&l<this.oP.maxentries&&this.oP.cache)
|
||||
{var arr=[];for(var i=0;i<l;i++)
|
||||
{var flagSearch=0;if(this.searchType=="*searchtype*"&&this.aSug[i].value.toLowerCase().indexOf(val.toLowerCase())>0){flagSearch=1;}
|
||||
{var flagSearch=0;if(this.searchType=="*searchtype*"&&this.aSug[i].value.toLowerCase().indexOf(val.toLowerCase())>-1){flagSearch=1;}
|
||||
if(this.searchType=="searchtype*"&&this.aSug[i].value.substr(0,val.length).toLowerCase()==val.toLowerCase()){flagSearch=1;}
|
||||
if(this.searchType=="*searchtype"&&this.aSug[i].value.substr(this.aSug[i].value.length-val.length).toLowerCase()==val.toLowerCase()){flagSearch=1;}
|
||||
if(flagSearch==1){arr.push(this.aSug[i]);}}
|
||||
|
||||
@@ -204,7 +204,7 @@ _b.AutoSuggest.prototype.getSuggestions = function (val)
|
||||
|
||||
var flagSearch = 0;
|
||||
|
||||
if (this.searchType == "*searchtype*" && this.aSug[i].value.toLowerCase().indexOf(val.toLowerCase()) > 0) {
|
||||
if (this.searchType == "*searchtype*" && this.aSug[i].value.toLowerCase().indexOf(val.toLowerCase()) > -1) {
|
||||
flagSearch = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user