135
Views
12
Comments
Solved
how to make a checkbox stay selected after page refresh?
Application Type
Reactive

i have a form with checkboxes. When a user selects a checkbox, it saves the data to the database with a OnChange action. But when i select a checkbox and i refresh the page, the selection goes away. So it still is saved to the database, but the checkbox is not selected anymore. How can i make the selected checkbox stay selected even after page refresh?

this is the aggregate i use for the checkbox:

this is for the checkbox onchange:

2021-08-12 05-19-40
Shubham Janbandhu
Solution

Hi sam m,

Hope you are doing well.

As per screenshot, looks like you are using Static entity and you would like to perform CURD operation on it that is incorrect. I understand that you are calling Static entity data like Engels, Nederland, and Spaan, etc but you couldn't perform CRUD operation on it. I tried to map the requirement and created a demo for this please check it out and let me know if you need further assistance on it. You can also modify the logic because everyone has their own method, but it will help to implement kind of logic.

Ex. Try this link, Demo

v



Regards,

Shubham  

Demo.oml
2025-04-17 05-42-16
Ajit Kurane

Wonderful Demo. I was trying in other way but this one is superb.

2020-06-02 21-09-21
Tiago Ferreira

Hi Sam,

Probably you are not assigning the value from the database to the IsSelected variables when you enter the screen.

UserImage.jpg
sam m

Hi @Tiago Ferreira , how can i assign the value from the database to the IsSelected when entering the screen?

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @sam m ,

What are you doing with that join with a structure ? 

Structures are not persistent data, only entities are.

You say you store it in the database.  Whatever entity you do that in should be part of your aggregate.

Dorine

UserImage.jpg
sam m

thank you for your answer. What do i have to do with that extra entity in the aggregate? 

2021-09-06 15-09-53
Dorine Boudry
 
MVP

In your original post you say you save the checkbox choice to the database.  So if you want to show that in your ui, you'll have to retrieve it in your aggregate.

I don't know exactly how, as I don't know your datamodel.

If this sounds at all unfamiliar to you, I'd recommend taking some of the tutorials.

Dorine  

2025-04-17 05-42-16
Ajit Kurane

Hi Sam,

If you are saving values to the database then you can try to retain it using onafterfetch event property of the aggregate. As you are saying the selection goes away and it still is saved to the database its just because of you are saving those vaules in onchange action.

Thanks,

Ajit Kurane.

2020-02-05 04-54-55
Changalrao Bairaboyana

Hello @sam m 

You can assign that value to a session variable of that type, in this case the value will persist.

Let me know if that works for you.





2022-12-09 04-50-17
Shubham Doshi

Hello Sam,

You are saving your selected data inside a structure "IsSelected" which is non-persistent. In this case you have to save your data inside entity rather than a structure and assign it to checkbox. 

2025-12-17 21-10-06
Shlok Agrawal

The boolean value isn't getting updated I assume. Because you must not use structure you will have to use an entity or try using 1 to 1 mapping.

2023-12-30 05-18-27
Suraj Bhosale

Hi Sam, 

Using client variables, you can achieve that one.

Thanks,

Suraj Bhosale.

2021-08-12 05-19-40
Shubham Janbandhu
Solution

Hi sam m,

Hope you are doing well.

As per screenshot, looks like you are using Static entity and you would like to perform CURD operation on it that is incorrect. I understand that you are calling Static entity data like Engels, Nederland, and Spaan, etc but you couldn't perform CRUD operation on it. I tried to map the requirement and created a demo for this please check it out and let me know if you need further assistance on it. You can also modify the logic because everyone has their own method, but it will help to implement kind of logic.

Ex. Try this link, Demo

v



Regards,

Shubham  

Demo.oml
2025-04-17 05-42-16
Ajit Kurane

Wonderful Demo. I was trying in other way but this one is superb.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.