Autocomplete - Datasource results do not show up in an autocomplete field when using $userInput


You are using the $userInput Velocity variable in a field query but the result do not show up in the autocomplete field?

Example query

SELECT id, username
FROM users
WHERE user_group LIKE '%$userInput%'

Example template



When you use the $userInput in your query with the autocomplete, keep in mind that there is a double filter :

  • Your query results are constrained by the value in $userInput
  • The autocomplete field will filter the returned results against the user input too


That means that your edit display template must absolutely contain the variable filtered by the $userInput or the autocomplete will not display it.

In the example above, the issues are filtered by user_group.
The display template must absolutely contains the user_group too:

{username} - {user_group}