decorative banner

Working with events


    When a user performs an action on a wireless device, the WML browser captures the user's input. In technical terms, the user's action is called an event. You can use events to execute tasks in your WML deck.

    The following elements let you bind a task to an event:

    • The onevent element specifies a task to be executed when an intrinsic event occurs. An intrinsic event is generated when a user interacts with an element in the WML deck. For example, a user entering a card via the go element is an intrinsic event.
    • The do element specifies a task to be executed when an extrinsic event occurs. An extrinsic event is generated when a user presses a key on the device. For example, a user pressing a soft key is an extrinsic event.

    You can add these event-binding elements to both cards and templates. When you add a do element or onevent element to a template, the events apply to all the cards in a deck. (See Using a template.)

To add an onevent element:

  1. Drag the Onevent icon from the WML Elements set in the Objects palette into the document window. Release the mouse button when the pointer is over the colored area of a card element, template element, or option element.
  2. Choose the type of event to which you want to bind the task from the type pop-up menu.
  3. Add a task to the onevent element. (See Using tasks.)

To add a do element:

  1. Drag the Do icon from the WML Elements set in the Objects palette into the document window. Release the mouse button when the pointer is over the colored area of a card or template element.
  2. Choose the type of event to which you want to bind the task from the type pop-up menu.
  3. Set the following optional attributes in the Do Inspector:
    • label to specify an text label for the element. A WML browser may display the text as a graphical button. Limit labels to 6 character or fewer to prevent truncation of the text.
    • name to specify a name for the event binding.
    • optional to choose whether or not the browser can ignore the do element.
    • xml:lang to specify the language of the element or its attributes.
  4. Add a task to the do element. (See Using tasks.)