0% found this document useful (0 votes)
45 views

Wmlexample - WML: Creating A WML Deck

This document discusses creating a WML deck with three cards: Login, Password, and Results. The Login card allows a user to select a username from a list. The Password card prompts the user to enter a password. The Results card displays the username and password entered by the user. Variables are used to store and display the user input across the different cards in the deck.

Uploaded by

Dheeraj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Wmlexample - WML: Creating A WML Deck

This document discusses creating a WML deck with three cards: Login, Password, and Results. The Login card allows a user to select a username from a list. The Password card prompts the user to enter a password. The Results card displays the username and password entered by the user. Variables are used to store and display the user input across the different cards in the deck.

Uploaded by

Dheeraj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Creating A WML Deck

In this example, we’ll start by creating a WML deck that allows us to first select a username
from a list, enter in a password, then have our selections repeated back to us. This will
illustrate the basic handling of user input, events, and variables all within one deck using
multiple cards.

Listing 1 - WMLExample.wml

<?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="Login" title="Login">


<do type="accept" label="Password">
<go href="#Password"/>
</do>
<p>
UserName:
<select name="name" title="Name:">
<option value="John Doe">John Doe</option>
<option value="Paul Smith">Paul Smith</option>
<option value="Joe Dean">Joe Dean</option>
<option value="Bill Todd">Bill Todd</option>
</select>
</p>
</card>

<card id="Password" title="Password:">


<do type="accept" label="Results">
<go href="#Results"/>
</do>
<p>
Password: <input type="text" name="password"/>
</p>
</card>

<card id="Results" title="Results:">


<p>
You entered:<br/>
Name: $(name)<br/>
Password: $(password)<br/>
</p>
</card>
</wml>

As you can see, the prolog of this document contains the XML version number to be used as
well as the Document Type Definition to be referenced. Following this comes the wml
document element (the deck) that contains three cards: Login, Password, and Results. Each
of these cards is defined using the element. Because the Login and Password cards also
define events, they use the element to define the event to be triggered. Figure 1 shows the
initial card loaded in a test browser.

Figure 1

When the "accept" type of the do element is encountered, it is displayed as an option on the
WAP device display (see Figures 2, 3, and 4).
Figure 2 Figure 3 Figure 4

Selecting this option causes the element to be analyzed.

If you are familiar with the anchor tag () in HTML, you know that it specifies an href
attribute that tells the browser where to link to if this anchor is selected. The WML element’s
"href" attribute works in the same manner. As with HTML, to link to another card in the
document, you simply prepend a # symbol before it. For example, to link to the Results
card, we define the following element:

<go href="#Results"/>
This Results card makes use of variables by retrieving and displaying the contents of the
name and password variables. Recall that variables are substituted into a card or deck by
using the following syntax:

$(variable_name)

You might also like