WML » Tags » setvar

Syntax:
<setvar name=... value=... />

The setvar tag is used to assign a value to a named variable.

The assignment is done using a name/value pair where the name is set by the name attribute and the value by the value attribute. The name of the variable in the name/value pair must be of correct syntax.

The setvar tag can only be nested in the go, prev, and refresh tags. It can be used more than once.
 
This is a self-closing tag.
 
Nested Tags:  None

Examples

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>
Explanation:

In this example, card6 sets the values for two variables and navigates to card7, where both values are displayed.

Language(s): WML

See Also: