Filter checkboxes with checked state

I have a form which is going to have many checkbox items populated from CMS.

How can i use the CMS filter to filter out checkboxes that has checked state?

Live link
Password: launchr213

Sharable Link

hey @dam.kasper87!

This is possible with an embed element within your list and adding the fs-cmsfilter-field = IDENTIFIER attribute to this element.

This thread has more info and pictures showing the process.

Let me know if you need help setting this up :slight_smile:

@Support-Luis , This is great, and i get the concept. :smile:

But i can get it working as expected.
Password: launchr213

I’m using fs-cmsfilter-field ="selection" on both the toggle label and the on/off div, to filter everything with “on” as expected output, but no results are found.

@dam.kasper87 you should be using a switch in your CMS Collection for this. This switch should be toggled on for items that you want to show when the Selected Metrics or North Star Metrics filter is applied.

Your embed should look like this and it should show true/false depending on the state of the switch, you should add the fs-cmsfilter-field = IDENTIFIER to the element custom attribute panel as the picture shows below.

@Support-Luis This makes sense for the North Star Metrics, as i can mark these as North Stars on/off on the CMS.

Not i don’t fully understand how i can apply this on the “Selected Metrics”, as the user is selecting and de-selecting them right there on the session itself.

So the “Selected Metrics” is actually based on dynamic information pr. session. Not static from the CMS.

I have recorded a 90 second video to give some more context on this issue :handshake:

Thanks for the video @dam.kasper87! I now see what you are after and you are right, this will not work for the Selected Metrics by the user.

We can try to use some costume code to filter out the list, if you are confident with some code you can start with the Attributes API.

@Support-Luis - I reviewed your API, but i don’t see any obvious way to filter based on dynamic values which are not coming from collection or database.

Did you handle this scenario before? Any pointer or hint would be helpful. And coding is no issue. :pray:t2:

@dam.kasper87 I have not handled this scenario before, usually we have no user interaction within the list.

One idea that I have in mind is for us to change the text/value of a hidden text block within the items that changes if the item is selected by the user. Kind of like what you are doing now for the styling. This element will be our ‘Selected by user’ identifier for CMS Filter.

If you can do this we can then go into the API to see how we can update the filter’s info so that when we apply the filter only the selected items stay in place.

I solved this through custom code and outside your API. It was a bit tricky, but works now. :fist: Thanks for your help :smiley:

@dam.kasper87 I am glad you got this working as you wanted!