I'm working on an app where I have the following issue:
If I press the back button in the app, in order to return to the previous page, the fields are being cleared of their previous values.
I solved this problem by:
a) storing the value of each input component's text property in a local storage variable
b) Putting some logic in the app which causes the text properties of the these input components to be set on page load, according to the local storage variable, ie
screen_91B7_onLoad = page2_onLoad = function() {
...
setText('page2_page2_input1', localStorage.getItem('variableTest'));
...
}
This works but the problem I'm having is that when I press "Test" and launch the app, the input field is being populated with a value from a previous session. E.g. if I typed the string "blah" into the field in a previous session, when I make changes to the app, press "save", and press Test, the input component will have a value of "blah" even though I've started a new session. Is there any way of avoiding this? Note that this only happens in the browser, not on mobile, but I'd like to be able to demo this to the client in browser, if possible, hence the issue.
Also - is there any better way of solving the issue of the pages not retaining their state once the back button is pressed other than by the use of Local Storage Variables?
Many thanks,
Brian
EDIT: I'd really appreciate someone explaining why this is happening at all. Surely once the window is closed, all data from the session - e.g. global variables - will be removed from the Browser's memory. How can they persist when the "test" window is closed and I even clear the Browser's cache???