Variables

Variable names in WML are prefixed with a dollar sign. The syntax is:
 
$variablename
 
If the end of the variable is not indicated by white space, you must contain the variable inside a pair of parentheses:
 
$(variablename)
 
The name of the variable can be composed of one or more uppercase or lowercase letters, digits, or underscores.
 
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_
 
The use of any other character will generate an error. Variable names are case sensitive.
 
Variables can be assigned a value by using either the setvar or postfield elements. The value assigned to a variable can be substituted (displayed) in the text of a card.
 
In this example, card6 sets the values for two variables using two setvar elements and navigates to card7, where both values are displayed.
 
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card6">
<p>
Please click accept:
<do type="accept">
   <go href="#card7">
      <setvar name="NameVar" value="DevGuru" />
      <setvar name="NumVar" value="348" />
   </go>
</do>
</p>
</card>

<card id="card7">
<p>
NameVar = $NameVar
<br />
NumVar = $NumVar
</p>
</card>

</wml>


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information