Forum Academy Marketplace Showcase Pricing Features

Keep selected state after page refresh

Hi, guys. Here is the thing. I need to select item and keep it selected. So, I created a custom state “selected” and it works when user clicks on a card, then it saves to database. It looks and works pretty good.

This item should be selected all the time, so I created workflow, when page is loaded - selected state should work when it exists in database. But I don’t know how to fill value.

May be somebody knows how to make state not temporary?

State is temporary by default so if you refresh the page it will be removed.

You can set a default state so that when the page refreshes it will revert back to the fault value.

If you refresh the page using Go to page workflow action, you can send the param with the value you want. The create On page load workflow to save that parameter to the custom state

The exact implementation is going to depend on what you save in the database, whether the selection is different for each user etc.

But basically somewhere in your database I’d have a yes/no field called “selected?” or something similar. When the toy is selected on your website, the workflow would change the custom state and change the database field.
When the user comes back to the page, there would be a workflow that sets the custom state according to what it reads in the database field.

I found solution. I added to option set one more attribut “number”

and then this workflow