Can checkboxes be pulled from CMS?

Hi there,

I am developing a little website for my local town theater. It’s a small project but they have a lot of events during the year with various performance’s days per event.

The guy of the theater said: is it possible to let the user select multiple performance’s days per event on the same event’s page. Because I knew Webflow had checkboxes, I said yes of course…

Now, I can pull a lot of informations & texts from the event’s collection list but it seems like checkboxes can not be pulled by CMS… ? I can’t see any option to link my checkbox to my event’s collection list.

How would you guys solve something like this ?
Is there a trick I’m not yet aware of ? :slight_smile:

I was thinking using reference or multi-reference fields, not sure how to approach the problem.

Thank you !

read-only link

EDIT: Okay I’ve successfully integrated multi-reference collection list into my Event, now I just need to understand, how can connect that multi-reference field with my checkboxes in my layout ?

Hey @anthonysalamin,

If its comes from a multiref you should do this on your collection page

however, not sure you ll manage to make it work at the end because i don’t think you can overwrite the ID.

Tricky one honestly.
Test this first, and then go back to me if you can’t find any solution, i ll have a deeper look.

1 Like

Hi there @zbrah :slight_smile:

Thank you for your answer, really appreciate !
I did try what you suggested, seemed legit to me too.

When you say I might not manage to make it work at the end, is there absolutely no way for me (Webflow) to change a checkbox ID pulled from a multi-reference field ?

Would you suggest I should look for a custom embeded code implementation instead ?

Merci ! :slight_smile:
Anthony

I just thought about something: dynamic embed :roll_eyes:

I already used dynamic embeds to style, through a CMS field, the color of my SVG icons through the entire project thanks to @vincent suggestion.

What about dynamic embed, using slug pulled from the multi-collection field to replace the checkbox’s ID ? Could something like this work ?

I know we’re talking about simple checkboxes but this is apparently the most critical part of the project as it consist of the “booking process” of the little theater I’m trying to work for. I’d feel so bad if I have to tell them I can’t finish the project because of an uncooperative checkbox :zipper_mouth_face::sweat_smile:

In other words, can we dynamically change a checkbox’s ID ?

Hey @anthonysalamin, we might need a divine intervention here to show us the way :smiley: , i feel lost too.
Yo @Brando, do you know where we should start on this ?
Thanks,

2 Likes

Hey @zbrah !

I think I found a lead through Dave’s how to dynamically change element’s ID project.
I created a new post on the Help Code section, have a look if you want :slight_smile:

It looks promising and I’m getting so close but I’m still missing something !

EDIT:

If I were to translate the code into english, I think I understand the overall meaning of it which is to :

" Select all element with the specific class: “dynamic-checkbox” that are within the collection list with the ID of “dynamic-items” and reset their ID with the Dynamic Embed field I specified. THe problem is, I think I’m missing something on the second line of the code… not 100% sure what it means or how to translate it into english."

2 Likes

@anthonysalamin @zbrah

It definitely looks like you are on the right track – super smooth workaround!

I’d say this needs a bit more JS experience as I’m unsure what piece you are missing in that script, Anthony. @bart any thoughts? Can you activate JS ninja skillz?

2 Likes

Thank you @Brando !

Well it seems like I’m targetting the wrong element, as I just realised that in webflow emails we get when someone fills in a form, the checkbox name isn’t based on its ID name but on its input name, apparently.

Therefore, I feel like I need to change something on the second line of the code, just not sure what exactly. Could be that @cyberdave has a lead or a precious piece of advise ? :blush:

Hey @anthonysalamin, @Brando. I am looking to do the exact same thing: have some checkboxes in a form that are loaded from the CMS. Maybe even filter them according to some rules.

Did you have any luck with this? Is it possible in Webflow?

Thanks for any help.

Hi @Sebastian_Murillo,

If you want to have a specific name, you could try add the following JavaScript command:
whateverCheckbox.setAttribute("name", "DynamicFieldName");