Autocomplete - Refresh API Query On Text Input

I’ve tried searching the forums and docs but somehow can’t seem to put the pieces together, so VERY sorry if this is a stupid question/request.

I have a form with a text input set to use autocomplete. I have a server-side component that queries a REST API using search parameters from the autocomplete text input. My API, however, only shows the first X results (up to 50) in the initial query. I’d like to set the text input field (where autocomplete is enabled) to refresh my API query on the server-side based on the text input and display those results in the autocomplete suggestions.

Any thoughts or suggestions on how to trigger the server-side API GET to update the result-set after input on a text input box and update the autocomplete dataset?

I think I follow what you mean.

So if your autocomplete form has a field, let’s say Name-=“filter” ID=“Inp_filter”

You want to set this as a parameter for your API sent as a $_GET parameter, lets say “filter”

To do this you simply bind the value of the $_Get parameter to the content of the inp_filter input like this

image

When you select a new value from the autocomplete, its value is automatically sent to server connect, the API query will fire, the result returned and the page results table will refresh

1 Like