Hide element when checkbox checked

Hey guys.

Haven’t found this in the forums but what I want to do should be pretty simple. I have checkboxes in a Repeating Group. When at least one of them are checked, I want to hide an input element. When all checboxes are unchecked, I want the element to be visible. After a good deal of experimenting, I’ve been able to use states to get the element to be invisible when checked but not the other way around.

Appreciate the help.

Hi there, @max.black761… I did a quick test and this condition on the input field appears to achieve the desired behavior…

Want to give that a shot and see if it gets you what you need?

Best…
Mike

Sorry I forgot to mention that the input is outside of the Repeating Group. So the checkbox isn’t available as a selection in the “When” box. That’s one of the reasons I tried to set states.

There are probably multiple ways, but here’s one using a custom state along with a conditional (as @mikeloc suggested)…

checkbox

The basic idea is to use a custom state to keep track of the number of checkboxes that are checked, and then use a conditional on the input to show/hide based on the custom state.

Here’s a link to editor.

EDIT: Oh yeah, forgot to mention that there’s a workflow on the checkbox’s input has changed event. That’s where the value of the custom state is set.

1 Like

Beautiful. That works great. Now if I can just add one more complication. What if the input I’m looking to hide or show is in a pop up in a reusable header and not on the page with the checkboxes and repeating group?

If I recall correctly, custom states defined on a reusable element are accessible from any page containing the reusable element.

1 Like

I forgot to mention My Fed Loan that the input is outside of the Repeating Group. So the checkbox isn’t available as a selection in the “When” box. That’s one of the reasons I tried to set states.