Fix tags autocompletion (#1329)

This commit is contained in:
Aleksander Machniak 2012-12-20 11:11:54 +01:00
parent 147af98783
commit 1c22cb542f

View file

@ -176,9 +176,9 @@
var checkAutocomplete = oldValue == true? false : true;
// check if the Value ist new
var isNewResult = isNew($(this).val(), checkAutocomplete);
if(isNewResult[0] === true || (isNewResult[0] === false && typeof isNewResult[1] == 'string')) {
if(isNewResult[0] === true || isNewResult[1] != null) {
if(oldValue == false && typeof isNewResult[1] == 'string') {
if(oldValue == false && isNewResult[1] != null) {
oldValue = true;
id = isNewResult[1];
}
@ -451,7 +451,7 @@
}
});
}
// If there is an entry for that already in the autocomplete, don't use it (Check could be case sensitive or not)
for (var i = 0; i < result.length; i++) {
var label = typeof result[i] == 'string' ? result[i] : result[i].label;
@ -459,7 +459,7 @@
label = label.toLowerCase();
if (label == compareValue) {
isNew = false;
autoCompleteId = result[i].id;
autoCompleteId = typeof result[i] == 'string' ? i : result[i].id;
break;
}
}