Hello,
I’m using Attributes CMS Filter + Combo Box.
My problem start when i want to share a URL with query params inside.
When i copy-paste the link with query params of CMS filter, it work and apply the 250.000€’s filter (live example - DM)
Then when i copy-paste the link with the query param of Combo Box, it doesn’t apply the “Alicante” filter to Combo Box’s field (live example - DM)
How could i solve this ?
Thanks a lot
Hey @formation.less.is.co! This is because you have multiple filter field identifiers for the combo box input. We can solve this with some JS to extract the query params and add them to the input Can you test this code?
<script>
window.fsAttributes = window.fsAttributes || [];
window.fsAttributes.push([
'cmsfilter',
(filterInstances) => {
console.log('cmsfilter Successfully loaded!');
const comboboxInput = document.querySelector('[fs-cmsfilter-field="ville, region, search"]');
const urlParams = new URLSearchParams(window.location.search);
const ville = urlParams.get('ville');
if (ville) {
comboboxInput.value = ville;
comboboxInput.dispatchEvent(new Event('input', { bubbles: true }));
}
},
]);
</script>
Let me know how it goes!
Thanks @Support-Luis,
I will not use the script but you point me the solution telling me that i had multiple field identifiers in the combo box.
I merge all fields in one and it work perfectly.
thanks.
1 Like