Show Search Results on CMS Filter Page from a different page

Im sure there is an easy solution for this, just having trouble executing. Jetboost uses this solution which works pretty well however their filtering lacks in comparison to Finsweets.

I am trying to replicate this using attributes. I want to get the initial search on the other page to add in the CMS filter field “*”=“query” when the page loads but am not having any luck.

Has anyone successfully done this?

Hey @brian! I am afraid this is not possible without some custom JS on your search page to generate the Query Params, CMS Filter should be able to apply the filter based on the generated URL. You can share a link to your page and I can help you out with the code if you’d like :slight_smile:

That would be awesome, thanks so much, Luis. Here is the read only URL.

The initial simple search is on the homepage and the CMS Filters page is called Properties Finsweet

hey @brian can you try this code?

<script>
      const userInput = document.getElementById('field');
      const button = document.querySelector('.button.is-navbar3-button.custom-search.w-button');

      button.addEventListener('click', function (e) {
        e.preventDefault();
        const searchIput = userInput.value;
        const queryParam = searchIput.replaceAll(' ', '+');
        const url = '/properties-finsweet/?*=' + queryParam;
        window.location.href = url;
      });
    </script>

You can also look into giving your search button an id so we can change the big query selector to a getElementById like we have dir the input field

Absolutely, thanks @Support-Luis , not sure which I was supposed to but I’m assuming the homepage. Code is added.

Yes, sorry. It should be added to the homepage. Have you tested it yet?

Excellent! It works. This changes the game. Thanks so much!

1 Like