Navigation | tutorials | data
Tasks and navigation-assignment and data exchange
This section briefly explains the variable assignment and data submission methods for WML, which are explained in a later section.
Variable Assignment (Setvar)
Setvar assigns a value to the browser's current page variable, which can be invoked in any card in the current dock.
Related properties:
1. Name variable name, as the identity of the access variable
Example: <setvar name= $bogus value= $bear >
2. Values of value variables
Data Interchange (Postfield)
Postfield uses a URL to exchange data with a CGI.
Related properties:
The name and value of the variable used for the name & Value Exchange parameter.
Example: <postfield name= $bogus value= $bear >
An example of a comprehensive application
Example:
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "http://www.wapforum.com/DTD/wml_1.1.xml" >
<wml>
<card id= "Start" title= "Sina WAP" >
<do type= "Accept" >
<setvar name= "mycgi" value= "/cgi-bin/count.pl" >
<go href= "$MyCGI" method= "POST" >
<postfield name= "One" value= "one One"/>
<postfield name= "Two" value= "two two"/>
</go>
</do>
<p>hello world!</p>
</card>
</wml>
The previous example is equivalent to generating a POST request for a count.pl?one= "one" &two= "two two".