I need help creating a search that references more than one input box

Question:
Could someone show me how to create a search that references more than one input box?

What are you trying to achieve:
I’m trying to create a search that filters blog posts on my homepage. When a visitor visits my website, they will be greeted with 2 boxes to input information and a search button. The first box will be a drop down box, “dropdown1”, that will be a drop down of many different industry types. The second box will be a text input box, “input1”, to enter the zip code of the industry they are trying to find in their area. The last box will submit the information that shows them their results. For example, “what’s the best - plumbing company - in - 48035 - submit.” This will then take them to the blog post that I created about the best plumbing company I’ve found in the 48035 area.

Any help would be appreciated. I’m not great with code, so I’m not sure where to start, but if I had something generic to edit, I think I could take it from there.

You can use onClick/onInput events and concatenate the strings into a search query with wix-data or do fuzzy searches with wix-search.

If you need professional help then try https://www.wix.com/marketplace for paid support.

maybe something like this

import wixData from 'wix-data';
import wixSearch from 'wix-search';

$w.onReady(function () {
  $w("#searchButton").onClick(() => {
    let industryType = $w("#dropdown1").value;
    let zipCode = $w("#input1").value;

    wixSearch.search(industryType + " " + zipCode)
      .documentType("Blog/Posts")
      .find()
      .then((results) => {
        // handle the results
        // You can display the results in a repeater, table, or any other way you prefer
      });
  });
});

1 Like