I have a requirement in an application to retain values even if use refresh or reload the page.
Is there a way to retain CDT values on page reload/refresh?
Discussion posts and replies are publicly visible
More info is needed in order to help with this - for instance, what "page" are we talking about? Are you talking about using the hard refresh in-browser (like hitting F5), or some internal refresh button/link on the interface? What CDT values are you talking about and where are they currently being stored? Can you give a big picture overview of the current behavior in a bit more detail, and what you would hope could happen instead?
Thanks for the response!
Actually, I have an application where the user is attempting an entry test with some questions and a timer. While the user is answering questions, if a hard refresh is performed, it should be in the same position like his answers should remain there and not lost and timer should be at the same time.
If the user's data inputs are saved into Rule Input variables during a task in a live process instance, then doing a hard refresh will cause the browser to ask the user to confirm they want to leave the current page. If the user insists, then I don't know of any easy functionality by which to prevent their data from being cleared. One fairly easy way to prevent this is to allow a user to save in-progress form values, which is built in functionality.
I guess the best solution (even though it is not a best practice) is that once the user enters a value, you do a do "saveInto" with a!writeToDataStoreEntity.
I have never tried, but I guess this should work.
a!textField( label: "",...... saveInto: a!writeToDataStoreEntity( dataStoreEntity: cons!APP_DS_FORM, valueToStore: ri!myCDT, ... ) )
Agreed, this could potentially work, though it requires, perhaps, exponentially more manual setup and manual upkeep. A slightly stronger solution might be to give a soft "save" button (not the default OOB one) that saves a CDT value to the DB when the user chooses; though using the same manual approach could also submit the task, save the values to PVs, then reopen the task which would perhaps be better.