From 649ea6bf63b86704b304efa50f502cdafb4f14ec Mon Sep 17 00:00:00 2001 From: Eric Allen Date: Sun, 20 Dec 2009 13:19:17 -0500 Subject: [PATCH] Only apply autocomplete to fields not yet enabled In some cases, double-applying it caused weird behavior. Filtering out fields that have already been autocomplete-enabled fixes #971 and probably other edge cases, too. --- public/javascripts/application.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 1fcc3f73..6266685e 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -187,11 +187,11 @@ function project_defaults(){ function enable_rich_interaction(){ $('input.Date').datepicker({'dateFormat': dateFormat}); /* Autocomplete */ - $('input[name=context_name]').autocomplete(contextNames, {matchContains: true}); - $('input[name=project[default_context_name]]').autocomplete(contextNames, {matchContains: true}); - $('input[name=project_name]').autocomplete(projectNames, {matchContains: true}); - $('input[name=tag_list]').autocomplete(tagNames, {multiple: true,multipleSeparator:',',matchContains:true}); - $('input[name=predecessor_list]').autocomplete('/todos/auto_complete_for_predecessor', + $('input[name=context_name]:not(.ac_input)').autocomplete(contextNames, {matchContains: true}); + $('input[name=project[default_context_name]]:not(.ac_input)').autocomplete(contextNames, {matchContains: true}); + $('input[name=project_name]:not(.ac_input)').autocomplete(projectNames, {matchContains: true}); + $('input[name=tag_list]:not(.ac_input)').autocomplete(tagNames, {multiple: true,multipleSeparator:',',matchContains:true}); + $('input[name=predecessor_list]:not(.ac_input)').autocomplete('/todos/auto_complete_for_predecessor', {multiple: true,multipleSeparator:','}); /* have to bind on keypress because of limitataions of live() */