+var id = <% "$name" |n,j%>;
+id = id.replace(/:/g,'\\:');
+jQuery('#'+id).autocomplete( {
+ source: RT.Config.WebHomePath + "/Helpers/Autocomplete/CustomFieldValues?"+<% $Context |n,j %>+<% $name |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;
+ }
+}