From 1c22cb542fe1a4362b6fb013a031f11f62ed9fab Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 20 Dec 2012 11:11:54 +0100 Subject: [PATCH] Fix tags autocompletion (#1329) --- plugins/tasklist/jquery.tagedit.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/tasklist/jquery.tagedit.js b/plugins/tasklist/jquery.tagedit.js index a9ffd77c..7c3a5e61 100755 --- a/plugins/tasklist/jquery.tagedit.js +++ b/plugins/tasklist/jquery.tagedit.js @@ -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; } }