Streaming live at 10am (PST)

How to replicate with custom code Webflow's Conditional Visibility based on CMS field being set

I’m trying to replicate Webflow’s now native conditional visibility based on whether a CMS item is set or not using custom code. The reason being is that I’m displaying a specific CMS item using cookies so I need to have all the information in a Custom HTML embed, and I need to be able to send this “field is set or not” information as a cookie as well.

Essentially I am trying to figure out this sequence:

  1. User clicks on a custom coded HTML button on a CMS item which creates cookie information from CMS item fields (I already have this part taken care of and working fine)
  2. Also need to send information as a cookie on whether or not a specific field of a CMS item is set (this is what I’m trying to figure out)
  3. Take that “set or not field” cookie and use it to either hide or show an element. (I can figure that out fine)

Here’s my preview. The custom code is in the top navbar.

Thanks a lot!

Nevermind. I think I have a way around it. I either have to make a function that shows/hides something based if a field is less than 1 character long. Or I can just create a switch field for the CMS item and send either true or false as a cookie.

Mods, you can delete these thread.