# Button acting as a visibility condition to 2 containers

**URL:** <https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147>\
**Category:** Ask for Help\
**Created:** [July 24, 2024, 8:41pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147 "2024-07-24T20:41:01Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedrop](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pedrop/32/71433_2.png) [@Pedrop](https://community.glideapps.com/u/Pedrop)\
**Post date:** [July 24, 2024, 8:41pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/1 "2024-07-24T20:41:02Z")

</div>

Hello guys, I’m not sure if it’s possible. But can I add a visibility condition to 2 containers ?

I mean I have 2 variables (containers) in a detail page, I wonder if I can filter it to only show one at a time if the button is pressed. It’s a male and female thing.

So wether the male button is pressed, only the male container will appear. Vice versa.

---

<div class="post-metadata">

**Author:** ![EvanFurniss](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evanfurniss/32/69473_2.png) [@EvanFurniss](https://community.glideapps.com/u/EvanFurniss)\
**Post date:** [July 24, 2024, 9:29pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/2 "2024-07-24T21:29:50Z")

</div>

You can store a variable in the row that is either male or female then only show the male container if it says male and vice versa.

Then either a choice component on the detail page with options male or female or a two buttons that use the set column action to set the variable in the row.

Let me know if that made sense, if not or you have further questions I can mock this up fairly quickly.

---

<div class="post-metadata">

**Author:** ![Pedrop](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pedrop/32/71433_2.png) [@Pedrop](https://community.glideapps.com/u/Pedrop)\
**Post date:** [July 24, 2024, 10:22pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/3 "2024-07-24T22:22:59Z")

</div>

Hey, Evan. Many thanks!! Ill definitely try that out and will be back.

---

<div class="post-metadata">

**Author:** ![Pedrop](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pedrop/32/71433_2.png) [@Pedrop](https://community.glideapps.com/u/Pedrop)\
**Post date:** [July 24, 2024, 10:35pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/4 "2024-07-24T22:35:00Z")

</div>

I think I need help hahaha would be glad if you could send the mock here.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 25, 2024, 12:01am UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/5 "2024-07-25T00:01:33Z")

</div>

Have you set up a user-specific column to store the choice as Evan said? Where are you stuck at the moment?

---

<div class="post-metadata">

**Author:** ![Pedrop](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pedrop/32/71433_2.png) [@Pedrop](https://community.glideapps.com/u/Pedrop)\
**Post date:** [July 25, 2024, 12:14am UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/6 "2024-07-25T00:14:01Z")

</div>

Hello, I have created 2 columns. The first one is “content” and the second is “gender”. I’ve added 2 rows, one male and the other female. That’s it. I’ve tried to add the choice component, but when I try to create the bond, it substitutes the content of the first column to “male” or “female”, it depends on which one I click.

Edit 1.: pictures

 ![IMG_4867](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/b/2b2333fc4e26ed1fb0dad9985d117b1488e0aa06.jpeg)  
 ![IMG_4868](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/d/4dbdfffcda225985e492cce905d96e9b70c6e446.jpeg)

Edit 2.: I rather use button blocks than the choice box

---

<div class="post-metadata">

**Author:** ![FrancoisDigico](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/francoisdigico/32/75651_2.png) [@FrancoisDigico](https://community.glideapps.com/u/FrancoisDigico)\
**Post date:** [July 25, 2024, 12:23am UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/7 "2024-07-25T00:23:15Z")

</div>

Hello, you can check this forum post about conditional select/choice.

> [@Conditional choice field](https://community.glideapps.com/t/conditional-choice-field/59434):
>
> Hello everyone, I am trying to build a form with 2 choice selections : one for countries one for cities Once a country is selected I would like in the second choice field to display only cities related to the country selected. Is it possible to that? What I am trying to do : Couldn’t find the topic so posting up. Thank you a lot ! slightly_smiling_face

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 25, 2024, 12:32am UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/8 "2024-07-25T00:32:53Z")

</div>

> [@Pedrop](#):
>
> substitutes the content of the first column to “male” or “female”, it depends on which one I click.

You need to write the selected choice to it’s own column. Preferably a user specific column. You don’t want it to write to a column that uses for something else.

> [@Pedrop](#):
>
> I rather use button blocks than the choice box

You can use a button block. Set the action on each button to a Set Column action and have it write the appropriate value to a column in the table.

Once you have the selected choice written to a table, then you can use that value to control visibilty of a container.

---

<div class="post-metadata">

**Author:** ![EvanFurniss](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evanfurniss/32/69473_2.png) [@EvanFurniss](https://community.glideapps.com/u/EvanFurniss)\
**Post date:** [July 25, 2024, 3:30pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/9 "2024-07-25T15:30:45Z")

</div>

Hey! I recorded a video explaining the setup process of this.

Hope this helps, feel free to ask questions.

https://www.loom.com/embed/300004105c8f4f5aafb628e04b8d3415?sid=995d90cf-a4b1-4bf5-9a81-78899ded220e

---

<div class="post-metadata">

**Author:** ![Pedrop](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pedrop/32/71433_2.png) [@Pedrop](https://community.glideapps.com/u/Pedrop)\
**Post date:** [July 25, 2024, 9:07pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/10 "2024-07-25T21:07:22Z")

</div>

That was great, (edit.: unfortunately the problem wasn’t solved 😕 ! Thank you very much Evan.

What is happening is: my 1st column is not user based, so the 1st row of the column is male and the 2nd female, but they are not pre-stablished anywhere, just gramatically. It’s just content.

I did everything you thought me through the video, great tutorial btw, the containers do change, but the content inside is only male (so, 1st row only) on both containers.

I’m doing something wrong.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 25, 2024, 9:51pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/11 "2024-07-25T21:51:16Z")

</div>

I suspected this issue would pop up. The problem is that your screen is attach to a single row but you are trying to display two rows. Instead of two containers, I would recommend a custom collection designed to look like your containers, but instead of setting visibility, you would set a filter on the collection to display the row that matches your choice.

Same concept overall, but replace the containers with a single custom collection, and instead of a visibility condition, set a filter on the collection.

---

<div class="post-metadata">

**Author:** ![Pedrop](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pedrop/32/71433_2.png) [@Pedrop](https://community.glideapps.com/u/Pedrop)\
**Post date:** [July 25, 2024, 10:18pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/12 "2024-07-25T22:18:03Z")

</div>

I see, that makes sense, thank you. Do you mean I will not be able to use button blocks? Only in-app filters?

---

<div class="post-metadata">

**Author:** ![Pedrop](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pedrop/32/71433_2.png) [@Pedrop](https://community.glideapps.com/u/Pedrop)\
**Post date:** [July 25, 2024, 10:42pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/13 "2024-07-25T22:42:30Z")

</div>

I did it guys, basically I combined Evan’s and Jeff’s tips.

I still used the button block.

What I did was: It’s a one row table with 2 columns - 1st is “content”, 2nd is “gender”.  
On the page, I did what Jeff said and created a custom collection, designed to be a container (with no action). And a button block following Evan’s tutorial, but what I did differently, I guess, was that I set to change two different values, which were content and gender. So everytime it changes, both change.

Thank you all

---

<div class="post-metadata">

**Author:** ![EvanFurniss](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evanfurniss/32/69473_2.png) [@EvanFurniss](https://community.glideapps.com/u/EvanFurniss)\
**Post date:** [July 26, 2024, 1:16pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/14 "2024-07-26T13:16:33Z")

</div>

I see what you did! Awesome work, enjoy!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [August 2, 2024, 1:17pm UTC](https://community.glideapps.com/t/button-acting-as-a-visibility-condition-to-2-containers/75147/15 "2024-08-02T13:17:13Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
