Skip to content

Autocomplete

Dario Leidi edited this page May 8, 2025 · 2 revisions

If there is need for autocomplete in a form field, please use the standard solution provided by OBS.

We use the jQuery autocomplete plugin implemented in autocomplete.js, and we have a generic partial to make use of it here

All you have to do is to:

  • Create an autocomplete method in the controller (or use an existing one if any), responding with the query in json. The param name is term. Important: The returned data should be an array of strings.
  • Use the shared/_search_box partial (see a minimal example here). Important: Pass the data: { source: <your_autocomplete_path> } parameter.
Clone this wiki locally