# Closing Popup on Save

**URL:** <https://forum.bubble.io/t/closing-popup-on-save/120805>\
**Category:** Need help\
**Created:** [November 13, 2020, 1:03am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805 "2020-11-13T01:03:56Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 1:03am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/1 "2020-11-13T01:03:56Z")

</div>

I’m looking for how to auto close the popup when the save button is clicked. Simple popup that has a reusable element in it that is the form. The save button is in the reusable element. The reusable element is the body of the popup.

Here’s a video showing my problem:

[![]( " - YouTube") ](https://www.youtube.com/watch?v=5PM7N9Yz1FY)

When I click SAVE, I want to close the popup, but all I see that I can hide are the reusable element objects. Hiding the group leaves the popup visible but now a blank white square in the middle of the screen. I could refresh the page, but I was hoping not to.

Can anyone tell me what obvious step I’m missing?  
Gracias!  
Buck

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [November 13, 2020, 1:30am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/2 "2020-11-13T01:30:29Z")

</div>

Hi there, @buckman… maybe the solution in this thread could work for you?

> [@How to Close a Popup from Reuseable Element Button?](http://forum.bubble.io/t/how-to-close-a-popup-from-reuseable-element-button/56679):
>
> I have a re-usable form within a popup. Since I have to define the element’s behavior within the element, how do I make the submit button also close the popup that the re-usable element is contained in? The popup doesn’t exist within the re-usable element, so I can’t seem to create a workflow to close the popup on submit.

Hope this helps.

Best…  
Mike

---

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 1:35am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/3 "2020-11-13T01:35:27Z")

</div>

I thought I made my popup reusable already…so I guess I’m still missing some piece of understanding.

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [November 13, 2020, 1:42am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/4 "2020-11-13T01:42:13Z")

</div>

It looks like add\_user\_group\_for\_popup is a reusable element that contains only the form elements, and that reusable element is placed in the popup (which is why you can’t access the popup from the Save button’s workflow) as opposed to the popup itself being the reusable element.

---

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 1:44am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/5 "2020-11-13T01:44:03Z")

</div>

So…there is no parent reference when using a “reusable” element? It seems that’s what I’m running into.

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [November 13, 2020, 1:46am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/6 "2020-11-13T01:46:34Z")

</div>

I don’t use a lot of reusable elements, but I did some quick testing before posting my first reply, and I couldn’t find a way to do it. Maybe we’re both just missing something simple, but I don’t think so, and that’s why I did a search that produced the other thread.

---

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 1:48am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/7 "2020-11-13T01:48:51Z")

</div>

Thanks a bunch…at least it’s inobvious…that at least makes me feel better about it 🙂 thank you for giving a stab at it. I didn’t want to recreate the popup if I didn’t have to, but without any kind of parent inheritance, I suppose I’ll need to. Thanks for that article as well…If I can’t find a way to do it with a custom state…I’ll probably try that route. Thanks again!

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [November 13, 2020, 1:50am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/8 "2020-11-13T01:50:25Z")

</div>

No problem at all… and funny you mention the custom state because I had the same thought, and now my curiosity is piqued, so I might give it a try, too. 🙂

---

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 2:15am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/9 "2020-11-13T02:15:37Z")

</div>

It worked!!! Sweet beans dude. It worked.

---

<div class="post-metadata">

**Author:** ![cmarchan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/cmarchan/32/253062_2.png) [@cmarchan](https://forum.bubble.io/u/cmarchan)\
**Post date:** [November 13, 2020, 2:15am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/10 "2020-11-13T02:15:59Z")

</div>

@buckman  
@mikeloc

One way I think about reusables is that they do not know what page they are on. That is why to connect them with page elements gets tricky. Also, for a reusable to talk to a separate reusable gets tricky as well.

When popups are involved one way to go is to build the popup within the reusable element. You can even nest reusables … just like a vanilla Bubble app handles its header reusable with its signup/login reusable:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/9/7/97b5850acfc3ed84ab94d49ff73b835ec2ffc66a.png)

---

<div class="post-metadata">

**Author:** ![cmarchan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/cmarchan/32/253062_2.png) [@cmarchan](https://forum.bubble.io/u/cmarchan)\
**Post date:** [November 13, 2020, 2:16am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/11 "2020-11-13T02:16:47Z")

</div>

This way you can find them easily within the flows of the “parent” reusable

---

<div class="post-metadata">

**Author:** ![cmarchan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/cmarchan/32/253062_2.png) [@cmarchan](https://forum.bubble.io/u/cmarchan)\
**Post date:** [November 13, 2020, 2:34am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/12 "2020-11-13T02:34:59Z")

</div>

@buckman

This is a great watch (2 mins) by the good folks at AirDev … do not get misled by the name of the tutorial … I think it will shed a lot of light when dealing with RGs and opening menu options in rows through a reusable “hack” \> [Bubble Hack: How to have a vertical menu that shows up on click within a repeating group cell](https://www.youtube.com/watch?v=HAf9umlP2Fg)

---

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 2:36am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/13 "2020-11-13T02:36:36Z")

</div>

Here is the solution.

[![](https://img.youtube.com/vi/XQ4fbRkgGK8/maxresdefault.jpg "HowToMakeAPopupDisappearInBubble") ](https://www.youtube.com/watch?v=XQ4fbRkgGK8)

If you want to use a Reusable Element as the form body in a popup, you set a custom state on your reusable element and then you set up a trigger on that element at the form level. Here is what I did step by step:

- I went to my Reusable Element and when the save button was closed, I added a custom state called “shouldClose” and set it to type “YES/NO” and a default of “YES” every time the save button is clicked  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/4/e/4e50eac6cbcf23e10477e6c73fd360dedc5ce9d7.png)
- then, I went to my form that hosts the popup and added a custom trigger that runs every time that also checks for that state  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/7/2/722abf69ea0e52206cb36bab6a3f97ae22a47051.png)
- step 1 of that custom event is to look for “shouldClose = YES” and if so to close the popup
- step 2 of that custom event is to set the value to “NO” so it doesn’t run until called again
- then, in my button that launches the popup, I set the state to “NO” there as well.

So, when the button is clicked, the state is NO and the popup stays open. When I click Save, it sets it to YES and it triggers the form-level event that happens to be the parent of the popup and that event closes it.

Works nicely!  
Buck

---

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 2:41am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/14 "2020-11-13T02:41:37Z")

</div>

Thanks @cmarchan and @mikeloc. I appreciate you both jumping in on this. Sometimes it just helps to be able to externalize these thoughts and frustrations in a lack of knowledge. I appreciate you both jumping in. Thanks again.  
Buck

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [November 13, 2020, 2:46am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/15 "2020-11-13T02:46:00Z")

</div>

Sweet beans, indeed! That’s awesome, man… great work. Hmm, maybe one of us should circle back on the thread that I linked to and link to your solution here. I’m happy to do it (giving you all the credit, of course), but I’ll give you the right of first refusal. 🙂

---

<div class="post-metadata">

**Author:** ![buckman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/buckman/32/76754_2.png) [@buckman](https://forum.bubble.io/u/buckman)\
**Post date:** [November 13, 2020, 2:46am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/16 "2020-11-13T02:46:47Z")

</div>

Go ahead. No sweat…thanks for asking tho.

---

<div class="post-metadata">

**Author:** ![calicass83](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/calicass83/32/181870_2.png) [@calicass83](https://forum.bubble.io/u/calicass83)\
**Post date:** [November 13, 2020, 11:11pm UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/17 "2020-11-13T23:11:23Z")

</div>

I’ll check it out - thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [January 22, 2021, 1:08am UTC](https://forum.bubble.io/t/closing-popup-on-save/120805/18 "2021-01-22T01:08:25Z")

</div>

Closed on January 22, 2021, 1:08am UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
