- Wireless Markup Language--Beyond the Basics
- Events, Tasks, and History
- Timers
- Tasks
- Deck Declarations
- Named Character Entities
- Scripting
Events, Tasks, and History
As discussed in the previous article, two types of events exist: explicit (user-initiated) events and intrinsic events. Intrinsic events occur as an indirect result of a user action or as a result of a count-down timer expiring. The types of events that a user directly initiates are listed here:
-
Clicking a soft key.
-
Selecting a link.
-
Entering a text URL or choosing a bookmarked URL.
-
Selecting or deselecting an option in a list. (Note that technically the WAP WML specification considers this an intrinsic event.)
-
Filling in an input field.
Events that occur indirectly or without user intervention are listed here:
-
Transition into a card (both forward and backward)
-
Timer expiration
When events are triggered, different actions may occur, including these:
-
Navigation to a new card or deck.
-
Context reset.
-
Update of context variables. (Note that context history is updated whenever navigation occurs/)
-
Intrinsic events and the onevent tag.
Intrinsic events are handled using the onevent tag or by making use of one of the equivalent shorthand attributes. Three intrinsic events can be handled at the deck or card level:
-
ontimer (a countdown timer expires)
-
onenterforward (a card is entered)
-
onenterbackward (a card is returned to)
These can be handled using the onevent element, as in this code:
<card id="Step1"> <onevent type="onenterbackward"> <go href="#OutOfSequence"/> </onevent> ... </card>
Or, this can be handled by using the shorthand notation:
<card id = "Step1" onenterbackward="#OutOfSequence"> ... </card>
These event handlers can be used to redirect a user to a warning card if that user navigates back into Step1. The second method illustrates how the shortcut event-handling attribute may be specified within the card element. A similar syntax is available for the ontimer and onenterforward shortcuts.