Hey everyone
I’m currently working on a section where users can search for the right contact person based on their postal code (ZIP code). I’m using Finsweet Attributes List Filter, and I’d love to get some input on whether the following setup is possible with the standard Attributes setup — or if I’d need to add custom JavaScript.
Here’s the idea:
- Each contact person is assigned to one or more postal code regions, defined by the first two digits of the ZIP code (e.g.,
04
,22
, etc.). - Users should enter their full ZIP code into an input field (e.g.,
04277
). - However, I only want to use the first two digits of the input to filter the list.
My questions:
- Is there a way to dynamically extract only the first two digits from the user input before filtering with Attributes?
- Or would I need to write some custom JavaScript to trim the input value before it’s passed to the filter?
- And if custom JS is needed, can it be combined safely with Attributes without breaking functionality?
Would love to hear your thoughts or see if anyone has done something similar!
Thanks in advance