Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

autocomplete.js was throwing Uncaught ReferenceError: Autocompleter is not defined because it depended on Prototype.js (Class.create()) and Script.aculo.us (Autocompleter.Base) which are not present in the repository.

Changes

  • Rewrote autocomplete.js as a standalone implementation with no external dependencies
  • Preserved API - existing JSP pages using new Autocompleter.DWR() work without modification
  • Added missing functionality: keyboard navigation, debounced input, HTML escaping, dropdown positioning
  • IE compatibility for scroll position detection via pageXOffset/pageYOffset fallbacks

Before/After

// Before: Required missing external libraries
Autocompleter.DWR = Class.create();  // Prototype.js - not loaded
Autocompleter.DWR.prototype = Object.extend(new Autocompleter.Base(), { ... });  // Script.aculo.us - not loaded

// After: Self-contained
var Autocompleter = Autocompleter || {};
Autocompleter.DWR = function(elementId, updateId, populator, options) { ... };

Screenshot

Autocomplete working

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdnjs.cloudflare.com
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

We're getting an error message in the browser console autocomplete.js:1 Uncaught ReferenceError: Autocompleter is not defined. This is supposed to be class within Direct Web Remoting that is supposed to be present in the environment when autocomplete.js is loaded, but I can't figure out where it is supposed to come from.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@rvosa
Copy link
Contributor

rvosa commented Jan 27, 2026

@copilot is autocomplete.js actually used anywhere?

Copilot AI changed the title [WIP] Fix ReferenceError for Autocompleter in autocomplete.js Fix Autocompleter is not defined error by making autocomplete.js self-contained Jan 27, 2026
Copilot AI requested a review from rvosa January 27, 2026 15:46
Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

@copilot is autocomplete.js actually used anywhere?

Yes, autocomplete.js is used in several places:

Loaded in templates:

  • defaultTemplate.jsp (line 42)
  • defaultSearchTemplate.jsp (line 41)

Autocompleter.DWR instantiated in:

  • algorithm.jsp - software name and algorithm type autocomplete
  • analysisStepForm.jsp - software name and algorithm autocomplete
  • citationForm-article.jsp - journal name autocomplete
  • addPersonForm.jsp - email address autocomplete
  • peopleForm.jsp - email address autocomplete

These provide autocomplete functionality for forms throughout the submission workflow.

@rvosa rvosa marked this pull request as ready for review January 27, 2026 15:54
@rvosa rvosa merged commit 4ba46b4 into master Jan 27, 2026
4 checks passed
@rvosa rvosa deleted the copilot/fix-autocomplete-js-error branch January 27, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants