From 89e70fd3999e0155c6b81a7b94288c84bb849c32 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 2 Jun 2015 13:32:01 +0800 Subject: Bug 1169418: Can't enter space in Keyword field --- js/field.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/field.js b/js/field.js index fdacd4728..d8ede471b 100644 --- a/js/field.js +++ b/js/field.js @@ -710,7 +710,7 @@ $(function() { that.removeClass('autocomplete-running'); if (document.activeElement != this) that.devbridgeAutocomplete('hide'); - }; + } var options_user = { serviceUrl: 'rest/user', @@ -724,6 +724,7 @@ $(function() { minChars: 3, tabDisabled: true, autoSelectFirst: true, + triggerSelectOnValidInput: false, transformResult: function(response) { response = $.parseJSON(response); return { @@ -757,6 +758,7 @@ $(function() { that.addClass('autocomplete-running'); that.data('counter', that.data('counter') + 1); + return true; }, onSearchComplete: searchComplete, onSearchError: searchComplete @@ -795,11 +797,20 @@ $(function() { delimiter: /,\s*/, minChars: 0, autoSelectFirst: true, + triggerSelectOnValidInput: false, formatResult: function(suggestion, currentValue) { // disable wrapping of matched substring return suggestion.value.htmlEncode(); }, + onSearchStart: function(params) { + var that = $(this); + // adding spaces shouldn't initiate a new search + var parts = that.val().split(/,\s*/); + var query = parts[parts.length - 1]; + return query === $.trim(query); + }, onSelect: function() { + this.value = this.value + ', '; this.focus(); } }); -- cgit v1.2.3-24-g4f1b