Skip to main content
Skip table of contents

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

Symptoms

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

Example query

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

Example template

CODE
{username}



Cause

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



Resolution

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:

CODE
{username} - {user_group}


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.