+var id = <% "$name-Values" |n,j%>;
+id = id.replace(/:/g,'\\:');
+jQuery('#'+id).autocomplete( {
+ source: <%RT->Config->Get('WebPath') |n,j%>+"/Helpers/Autocomplete/CustomFieldValues?"+<% $Context |n,j %>+<% "$name-Values" |n,u,j%>,
+ focus: function () {
+ // prevent value inserted on focus
+ return false;
+ },
+ select: function(event, ui) {
+ var terms = this.value.split(/\n/);
+ // remove the current input
+ terms.pop();
+ // add the selected item
+ terms.push( ui.item.value );
+ // add placeholder to get the comma-and-space at the end
+ terms.push("");
+ this.value = terms.join("\n");
+ return false;
+ }
+}