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

hey guys @brian @Support-Luis
i also need to filter across pages
can you please explain
i have this finsweet filter on /properties page that the user can have multiple filters and then when he/she clicks on the submit button of the form then the filtering is appllied to my collection list
i want also to put the filter form on my home page and and when the filters are changed and the search/submit button is pressed i want to move to the /properties page and the filters to have the values from the homepage and also of course the collection list to be filtered by them
so if i put this code on homepage it will work?