Learning WML: Tasks and Events
Pages: 1, 2, 3, 4, 5, 6

The <prev> Task

The <prev> task represents the action of returning to the previously visited card on the history stack. When this action is performed, the top entry is removed from the history stack, and that card is displayed again, after any <setvar> variable assignments in the <prev> task have taken effect.

The <prev> task takes no attributes.

Most uses of the <prev> task are very simple. Usually no variables are involved, and so most <prev> tasks are simply:


A <prev> task is most commonly used in connection with a <do> element (described in Chapter 4). Some browsers don't provide a back button unless one is specified in the WML, and so a great deal of WML contains the construct:

<do type="prev"><prev/></do>

This simply provides a button or some other user-interface construct, which when activated, sends the browser to the previous card.

One situation where it can be useful to include variables in a <prev> task is a login page, which prompts for a username and password. In some situations, you may want to clear out the password field when returning to the login card, forcing the user to reenter it. This can be done with a construct such as:

    <setvar name="password" value=""/>

Pages: 1, 2, 3, 4, 5, 6

Next Pagearrow