Chapter 3. WML Tasks and Events
In the last chapter, you learned about variables in WML, something not found in HTML. This chapter covers two further parts of WML—tasks and events—that have no real equivalent in HTML. (In some cases you can use JavaScript to achieve similar effects.)
Tasks
A WML task
is an
element that specifies an action to be performed by the browser,
rather than something to be displayed. For example, the action of
changing to a new card is represented by a
<go>
task element, and the action of
returning to the previous card visited is represented by a
<prev>
task element. Task elements
encapsulate all the information required to perform the action.
Tasks are used in many places in WML. Events (discussed later in this chapter) are tied closely with tasks, and many of the user interface elements (see Chapter 4) use tasks to perform actions.
To see how tasks are used in context, consider the element
<do>
, which represents some sort of control
that the user can activate, such as a softkey, a menu item on a cell
phone, or maybe even an onscreen button if the device has a
touchscreen. A <do>
element
isn’t itself a task element. Rather, it contains a task
subelement that specifies the action to perform when the user
activates the control.
A <do>
element that, on activation, simply
assigns the value wibble
to the variable
test
can be written as:
<do type="accept"> <refresh> <setvar name="test" value="wibble"/> </refresh> </do>
To have the same <do>
element instead send ...
Get Learning WML, and WMLScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.