Hi everyone!May I please ask if theres any search bar like the attached one can search xxx | near (location) ?


Thanks !!

Hello Michelle

Yes you can surely do that using WixCode !
Here’s so hints you can follow:

First step Design your search bar:

  • box

  • two text boxes (Find & Near)

  • two text inputs

  • line

  • search button
    Just create the design u want in this step. For easier explanation i will be using the following design.

Second step apply the functionality:

-you must have a collection that contains all the places the user can get.
-you must show a result. if there might be more than one result i suggest using a repeater or a table .
-you can show the result using different events ( user input : onChange, onKepPress, onBlur, on. Button : onClick , onDbClick …)

lets assume we’re using a collection , Button click to search, and showing the result in a repeater:

  • click on the button and add onClick event from the properties panel. here

  • on that event get the user inputs values and store them in two variables (place & near). here

  • after you have the values query the collection based on them. here

  • get the resulting array and format it to match the repeater data. here

  • using .forEachItem method set the values of the repeater items. here
    I hope this helps!

Best
Massa