June 9, 2000 - WML's Events | WebReference

June 9, 2000 - WML's Events

Yehuda Shiran June 9, 2000
WML's Events
Tips: June 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

WML supports the <onevent> tag. The following example uses one of the supported events, the onenterforward event. This event occurs when the script enters the card in which this tag resides. In this particular case, it is a help card. Here is the code:

<card id="card1_help" title="Help">
  <onevent type="onenterforward">
	<go href="currency.wmls#getInfoDate('date')"/>
  </onevent>
  <p>
  The currency rates were obtained from the Federal
  Reserve Bank of New York on $(date).
  <do type="prev" label="Back">
	<prev/>
  </do>
  </p>
</card>

We see here the tag, which calls the WMLScript function getInfodate(). This function loads the date variable with the date in the past on which the currency rates were obtained. It is invoked inside an onevent tag, with the event being entering the card, onenterforward.

The card itself includes two items. First is a free-text message, "The currency rates...." The second important item is the Back soft key. It is important to provide users with the key to go back from this Help card.

Learn more about WML and how to execute WML decks in Column 61, Introducing WML and WMLScript.