Showing a popup from a reusable header element

I’d like to launch a popup that lives in the reusable header element when clicking a button that lives on a page.

I’ve set up an example in the forum app here… https://bubble.io/page?type=page&name=call-from-header&id=forum_app2&tab=tabs-1

I tried to use the show an element action, but it only seems to allow you to choose from elements that live on that particular page. It does not seem to allow you to choose from elements (or containers) that live in the header even though the header is also on that page.

Any suggestions would be most appreciated.

Thanks.

The element that opens the popup (the button) has to be in the header as well.

1 Like

Why does the popup need to live in the header ?

You can trigger another reusable element to appear from the header … but if you put the popup on the header (even hidden) it gets a bit messy as the header is now quite deep.

Passing data from a header (like a global search bar) to another reusable element is possible.

And might be easier now.

3 Likes

The popup lives in the header because currently I have signup and login buttons in the header that trigger popups with signup and login forms on them. I wanted to also be able to trigger that signup popup (which lives in the header) from another signup button that lives on a page (not in the header).

Ah, no. You are right.

EIther the button and popup need to both be in the header, or both on the page.

You can use a “Do When Condition is True” workflow, so that your button on the page sets a state on the header, and the popup appears.

But I can’t get the popup to appear again a second time. Have updated the forum app page.

2 Likes

Nope, you were right (again). Your solution works. You just forget to set Element for the “when popup is closed” event in the header. I set it and now it works.

Check it out… Forum_app2 | Bubble Editor

Thanks @NigelG!

2 Likes

Hi,

I’m trying to do this same thing and am stuck. I think I’m missing something pretty basic about setting the state of an element, but I can’t figure out exactly what I’ve done wrong.

In this example I’d like the following workflow:

If the user is not logged in and they try to favorite a project page (by clicking the heart) the popup that is nested in the header (login/signup) appears.

Also, I’m trying to share a view-only editor link but can’t remember how. Sigh.

https://trystudio.co/version-test/p?debug_mode=true

Help?

Thanks!
Jen

Hey Jen :slight_smile: You can do this by setting the state on the resuable header. For example, on the page with the button, you can create a workflow which “When favorite button is clicked and current user isn’t logged in”, element actions --> set state --> element: header, custom state: popup (for example, type: yes/no), value: yes.

Then inside the resuable element header, create a “Do when condition is true (every time)” event which is “When this header’s popup is yes” --> Show Login/Popup.

Then create a second event inside the reusable header which is “When Login Popup is closed” --> set the popup custom state back to “no”. I’m pretty sure this should work. If not, you can go to the Settings tab and set the app to be “Everyone can view”, then paste in the editor link. Or feel free to PM me if you prefer.

*My mistake, I think the creation of the custom state has to happen first inside the reusable element, not on the page.

4 Likes

Hi!

Thank you so much for your reply! I’ve nearly go this working.

You can see it working well here:
https://trystudio.co/version-test/try?debug_mode=true
When you aren’t logged in and try to click the empty heart to favorite a project.

I was thinking of adding a “sign up” button to the footer so that the same login/signup popup that displays from the top right sticky menu can be triggered from the reusable footer element.

Is there a way to do that without adding the “sticky anon” reusable element inside the footer reusable element?

If not, then is there a way to make the instance of “sticky anon” in the footer always not visible?

Thanks so much!

PS: I have it set now to “everyone can view” but when I tested in a private browser I was redirected to bubble.is. I’m standing by to hear how this works on your end!

Hi Jen!

No problem at all :slight_smile: When I click the empty heart nothing appeared; at the moment there is no workflow action for that icon in the dev vesion?

For the footer, could you have a regular ‘Sign Up’ button, and add another copy of the Sign Up/ Login Reusable element to be in that footer? (appearing only when Sign Up is clicked)?

Oh interesting issue with the empty heart! I’ll have to take a look.

I was thinking of doing that with the footer but thought there might be another way that eliminates having the redundancy. I’ll try it next and let you know how it goes. Thanks so much for your help!

Yes let me know for sure! I think having it in the footer might be the easiest way (though it is a little repetitive!) No problem at all! :slight_smile: