The Wireless FAQ

4.10 How do I prevent variables from being stored in the cache?

Variables are stored in the cache so that may be re-used if the user jumps back to a previous input card, he doesn't have to retype but merely change what he wants to change. However, in some cases this functionality is causing a problem. Take a WAP chat system for instance where the same variable name is used over and over again, but with different content every time. Some browsers such as the one in the Nokia 7110 also have problems with clearing the variables even when it should.

In WML, the <card> tag has a parameter called newcontext which when newcontext="true" clears all variables. However, this also clears the navigation history which means that Back buttons will no longer work. If you want to clear the variables and the navigation history, then use newcontext.

To clear a variable, you can tell the browser to set the value of it to nothing. This is done like this:

<setvar name="one_variable" value=""/>
<setvar name="another_variable" value=""/>

However, that doesn't always work. In some cases you should be able to solve it with a fancier method of emptying the variable with an onenterforward event like this:

<onevent type="onenterforward">
  <setvar name="one_variable" value=""/>
  <setvar name="another_variable" value=""/>
[ Main ]   [ 04 - Serving WML contents ]