How to show a previously visible element after a page refresh?

Hello

For people building 1 page style apps, showing and hiding groups based on conditionals to emulating navigating pages, how do you show a group/element that was visible/in-use before a page refresh?

I dont want my users to have to re-navigate through everything just because the page has been refreshed.

Thanks

Hey @knocode :wave:

I have been using url parameters, so when the page is refreshed, the user doesn’t lose where they were at. Have you worked with url parameters before? It’s similar to using set states. :blush:

1 Like

Could you give me an example?

I have page “Index”.

Within it, I have 2 groups, “group-dashboard” and “group-settings”.

If group-settings is visible, and then the user refreshes the page, how would URL parameters come into play here?

Sure. Here is the reference for it if you are interested: Navigation - Bubble Docs…

So you can choose ‘Go to page’ in a workflow and choose the page you are in. Then add a parameter called ‘page’ and you can send it either dashboard or settings.

In the url it will look like this:

www.yourdomain.com?page=dashboard

Then on the condition of your element you would hide it by default and then display it when ‘Get data from page URL’ and choose ‘page’ is ‘dashboard’. Then show the dashboard element.

Does that make sense? :blush:

If I was at my computer I would give you and example.

You can have as many parameters as you want.

1 Like

Amazing. I think you’ve given me the direction I need.

You’re a life saver. I greatly appreciate it.

Thank you

1 Like

It works perfectly.

Thank you very much.

Could I bother you with another question?

Are you familiar with workflows that might allow a new user to “get started” with a service and then sign up/login somewhere in the middle of the process?

I have a particular issue with figuring out how to work with returning users who may have started creating new things within my bubble database without first logging in, and keeping those things attributed to them within the database once they eventually log back in.

For example, let’s say I have a workflow that allows a user to create a “vehicle.” New users can create the vehicle, sign up in the middle, and the data will carry over. They’ll be recognized as the thing’s creator.

But for returning users, the vehicle will no longer be associated with the user once they log back in. And I cant change the thing’s “creator” to be the current user.

Are you familiar with this type of issue?

1 Like

Yeah, I have seen that before. Hmm :thinking:

You can attach things to the current user as you are building it then once they create an account it will still be attached to them. So maybe have a field on the user called vehicle and attach it that way instead of referencing the vehicle based on who created it? Would that work?

This is, of course, if you have cookies enabled by default. Otherwise the current user won’t save.

1 Like

Hmm. That might work.

That is similar to another trick I was going to try, which was to make the vehicle a “state” throughout the workflow so that if the page is reset or the returning user is logged in, everything will just repopulate whatever groups/fields I’d have.

1 Like

Well, it’s worth a shot. There is always more than one way to do something. This was just one idea. :blush:

1 Like

Hmm. Turns out I had cookies on by default, meaning my app created temp users. This is probably the issue.

I’ll have to run a few tests to see, but once again, thank you.

1 Like

Hey, in what workflow do you put “Go to page” ? Like “when the page is loaded” or something else ?
Thanks

Hey @felixthiollier63 :wave:

You would do a ‘Go to page’ on ‘page is loaded’ if there is no page in the URL. Also, each button that you click to change the ‘view’ on your page would also have this ‘Go to page’ in the workflow.

Does that help?