Introducing WML and WMLScript: WML Crash Course - Part III | WebReference

Introducing WML and WMLScript: WML Crash Course - Part III


Introducing WML and WMLScript

A Crash Course in WML - Part III

The user agent can change cards by the <go> tag. This tag can call either a WMLScript function or move to another card of the WML deck. Clicking the Help option triggers a switch to card card1_help:

<do type="help" label="Help">
  <go href="#card1_help"/>
</do>

Clicking the Calculate option triggers a call to a WMLScript function called convert, defined in currency.wmls:

<do type="accept" label="Calculate">
  <go href="currency.wmls#convert('conversion','$(from)',
                                       '$(to)',$(amount))"/>
</do>

The second card of the deck, card1_help, demonstrates a few unique features. Here is the full definition:

<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 again here the <go> 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.

Next: How to program in WML - Part III

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

Created: May 8, 2000
Revised: May 8, 2000

URL: http://www.webreference.com/js/column61/6.html