Display Message When Repeater Search Returns No Results
Learn how to display a message for your website users when a search or dynamic filters acting on a repeater returns no results, using Corvid (a.k.a. Wix Code).
This example assumes you have already set up a repeater which can be dynamically filtered or searched in some way - if not, please see our code on filtering repeaters. The repeater in this example uses data from the #dbEmployee database and uses a text input field for keyword searches (#iptSearch) and a dropbox filtering department options (#iptDepartment1). Try the example below by searching for a name not listed in the table e.g. Sally, or by selecting a department not listed in the table e.g. Marketing.
Try it!
#iptSearch
#iptDepartment1
First Name
Last Name
Department
Jane
Austen
Operations
Jenny
Cruz
Sales
Joy
Dunner
Sales
Josie
Fay
Finance
Jim
Fraser
Finance
Judith
Jane
Finance
Your search has returned no results.
The resultsCheck function determines how many rows are retrieved after the filter is completed. If no results are returned, a text element called #txtNoResults is displayed with a message informing the user that the filter has returned no results. At the same time, the repeater is collapsed and hidden. If the filter does return results, then the #txtNoResults element is hidden while the repeater is revealed.
Page Code