CMS Filter + Query Params

Hi,
i don’t know if it’s possible but i was trying to combine the query parameter tools and the filtering tool.

Ideally i want to flag a checkbox based on the query parameter but even using a texfield would be ok.

I’m now pre-populating the textfield used to filter all the fields (filter = *)
The query parameter appears correctly inside the textfield but the filter does not start. if i type a single letter everithing works. how do i trigger the filtering right after the loading and using the query parameter pasted into the textfield?

Hey @gianluca! You’ll need to simulate a user input. This can be done easily with this code snippet

<script>
  window.fsAttributes = window.fsAttributes || [];
  window.fsAttributes.push([
    'cmsfilter',
    (filterInstances) => {
      const searchInput = document.querySelector('#YOUR_FIELD_ID or .FIELD_CLASS');
      searchInput.dispatchEvent(new Event('input', { bubbles: true }));
    },
  ]);
</script>

Simply modify the query selector to correctly select your input and all should work :wink:

thanks, i’ll try it out and will let you know