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:
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
Wonderful Demo. I was trying in other way but this one is superb.
Hi Sam,
Probably you are not assigning the value from the database to the IsSelected variables when you enter the screen.
Hi @Tiago Ferreira , how can i assign the value from the database to the IsSelected when entering the screen?
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
thank you for your answer. What do i have to do with that extra entity in the aggregate?
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.
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.
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.
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.
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.
Using client variables, you can achieve that one.
Suraj Bhosale.