WML Language Reference

[Cover] [Previous Section] [Next Section] [Index]

Section 11 out of 13 total sections


Chapter  2
Elements and Attributes


This chapter provides reference information for WML 1.1 elements and attributes. The elements are listed in alphabetical order, with available attributes shown for each.



<access> element

The <access> element specifies access control information for a WML deck. You must specify this element within the deck header along with any meta information for the deck (for more information, see <head> element and <meta> element). Each deck can have only one <access> element. All WML decks are public by default.


Syntax


Attributes

domain
(optional)  

The URL domain of other decks that can access cards in the deck. The default value is the domain of the current deck. 

path
(optional)  

The URL root of other decks that can access cards in the deck. The default value is "/" (the root path of the current deck) which lets any deck within the specified domain access this deck. 

NOTE     For a detailed explanation and examples of how the domain and path attributes work together, see the UP.SDK Developer's Guide.



<anchor> element

The <anchor> element anchors a task to a string of formatted text, often called a link. You can specify a link within any formatted text or image. When a user selects the link and presses ACCEPT, the device executes the task.


Syntax

where task represents the action to perform when the user activates the link and text is the text the device will display to represent the link:

task  

You must anchor one of the following task elements to a link: 

 

 
<go>
<prev>
<refresh>
 

(see <go> element)
(see <prev> element)
(see <refresh> element

text  

Devices typically set this text off from surrounding text, for instance, by enclosing it in square brackets (see example) or underlining it if the device can display bitmap images. 


Attributes

title
(optional)  

A label that identifies the link. If you do not specify the title attribute, the device uses the word "Link" as the default label. 

Devices use this attribute in a variety of ways. For example, they may use it to display a tool tip or issue a voice prompt when the user selects the link. The UP.Browser uses the title as the ACCEPT key label when the user selects the link. To ensure compatibility on a wide range of devices, label should be a maximum of five characters. 


Example

The following WML defines the card shown in Figure 2-1.

Figure  2-1.     Card containing links

NOTE     Note that the ACCEPT label changes depending on which link is selected.



<a> element

This is the short syntax form for anchors. It uses the <a> tag instead of the <anchor> tag, and can only be used to define (implied) <go> tasks that require a URL specification:



<b> element

The <b> element specifies bold text.


Syntax

where text is the text to display in bold font.


Example

The following WML defines the card shown in Figure 2-2.

Figure  2-2.     Card containing bold text



<big> element

The <big> element specifies large font text.


Syntax

where text is the text to display in large font.


IMPORTANT     The UP.Browser software does not currently support this element.



<br/> element

The <br/> element specifies a line break, i.e. causes the device to display the subsequent text or image on a new line.


IMPORTANT     When you define an <input> or <select> element, the UP.Browser displays the text you specify before the element definition as a user prompt for the item. If you define multiple <input> or <select> elements within a card, you cannot insert line breaks within that text--if you specify the <br> element in the text flow preceding these elements, the UP.Browser uses it as a break point for partitioning your fields into multiple screens. The net result is that only the last portion of your user prompt appears on the same screen as the entry field or selection list.


Syntax

NOTE     Unlike HTML, all WML elements require the end-element character (/). Thus, to insert a line break in WML, you must specify <br/> rather than <br>



<card> element

A WML deck consists of one or more <card> elements, each of which specifies a single interaction between the user and the device. Devices display a maximum of one card at a time--in some cases, however, a single card may appear as a series of screens. For information on related elements, see <template> element and <wml> element.


Syntax

where content represents the WML card definition and consists of one or more of the following elements:

content  

You can specify any of the following elements in your card definition: 

 

 
<onevent>
<timer>
 
<do>
<a>
<fieldset>
<img>
<input>
<select>
 
<p>  

(see <onevent> element)
(see <timer> element)
(see <do> element)
(see <a> element)
(see <fieldset> element)
(see <img> element)
(see <input> element)
(see <select> element

(see <p> element 


IMPORTANT     The contents of a <card> element must be in the following order:

With the exception of the elements listed above, devices display these elements in the order in which you specify them.


Attributes

id
(optional)  

Specifies a name for the card. The name acts as a fragment anchor for navigating to that card. For example, you can specify <go href="#cardname"/> to navigate to the card (see <go> element). 

title
(optional)  

Specifies a brief label for the card. The UP.Browser uses the label as the default bookmark name when the user bookmarks the card. Some devices might use it for other purposes, such as popup tooltips.  

Note: The UP.Browser does not display the title as part of the card content. The phone manufacturer may optionally display the title if there is sufficient screen real estate. The title attribute should be considered as a hint to the user and not as part of the card content. 

new
context
(optional)  

true | false  

Specifies whether the device should initialize the context whenever the user navigates to the card through a <go> task. Specifying newcontext="true" removes all context-specific variables, clears the history stack, and resets the device state to a well-known value. 

ordered
(optional)  

true | false  

Specifies the organization of card content (see Order options below). ordered="true" causes the device to display content in a fixed sequence. ordered="false" allows users to choose the order in which they navigate between content items. 

onenter
forward
(optional)  

Specifies the URL to open if the user navigates to this card through a <go> task. This attribute represents an abbreviated form of the <onevent> element (see Example 2 below and <onevent> element). 

onenter
backward
(optional)  

Specifies the URL to open if the user navigates to this card through a <prev> task. This attribute represents an abbreviated form of the <onevent> element (see Example 2 below and <onevent> element). 

ontimer
(optional)  

Specifies the URL to open if a specified <timer> element expires. This attribute represents an abbreviated form of the <onevent> element (see Example 2 below and <onevent> element). 


Order options

The ordered attribute lets you specify how the device will display multiple content items within a card.

True displays the items in a linear sequence (the default value). Use this setting for short forms containing (mostly) required fields. If a device cannot display all the items on one screen, it divides them into multiple screens based on:

False allows users to navigate between items in any order. Use this setting for cards containing optional fields or items with no logical order. If a device cannot display all the items on one screen, it may display a summary card that uses the title attribute for each item to identify the available options. Users can navigate to individual items from the summary card (and then select an option or enter a value, depending on the item definition).


Example 1

The following WML defines the deck shown in Figure 2-3.

Figure  2-3.     Card navigation within a deck


Example 2

The two sample cards shown in Figure 2-4 illustrate the relationship between the onenterforward attribute and the <onevent> element. In this case, specifying onenterforward as an attribute of the <card> element is exactly the same as specifying the <onevent> element with type="onenterforward"--both cards produce the same results.

Figure  2-4.     Equivalent methods for binding a <go> task to an event

Using the abbreviated form implicitly associates a <go> task with the event. The main reason to use the expanded form is to associate a <noop>, <prev> or <refresh> task instead (see <onevent> element for more information).



<do> element

The <do> element associates a task with an element within the user interface (for example, a function key, graphically-rendered button, or voice-activated command). When the user invokes the user interface mechanism, the device performs the associated <do> element task.


Syntax

where task represents the action to perform when the user activates the specified interface mechanism:

task  

You must bind one of the following task elements to the user interface mechanism: 

 

 
<go>
<prev>
<noop>
<refresh>
 

(see <go> element)
(see <prev> element)
(see <noop> element)
(see <refresh> element


Attributes

type
(required)  

Identifies the generic user interface mechanism that triggers the specified <do> element task (see descriptions below). 

label
(optional)  

A label that identifies the task with the user interface mechanism. For example, if you bind a task to the ACCEPT key, the device displays this value as the function key label. If you do not specify the label attribute, the device uses the word "OK" as the default ACCEPT key label. To ensure compatibility on a wide range of devices, label should be a maximum of five characters. Devices ignore the label attribute if they do not support dynamic labelling. 

The UP.Browser software does not currently support this attribute for the following TYPE values (see above):  

  • type="delete"  
  • type="help"  
  • type="prev"  

name
(optional)  

Specifies a name for the <do> element. If a card-level <do> element (i.e. defined within a <card> element) has the same name as a deck-level <do> element (i.e. defined within a <template> element), the card-level binding overrides the deck-level binding. 

optional
(optional)  

true | false  

Specifies whether the device can ignore this element. 

You can specify the following values for the type attribute (all types are reserved except where noted):

type value  Perform task if user ... 
accept  

Invokes ACCEPT mechanism (function key, button, etc.). 

delete  

Invokes DELETE mechanism (function key, button, etc.). 

help  

Invokes HELP mechanism (may be context-sensitive). 

options  

Invokes OPTIONS mechanism (function key, button, etc.). 

prev  

Navigates to card by invoking PREV mechanism from another card. 

reset  

Invokes RESET mechanism (clears or resets current device state).
The UP.Browser does not currently support this attribute value

unknown  

Invokes unknown mechanism (equivalent to TYPE="").
The UP.Browser does not currently support this attribute value

vnd.co-type  

Invokes a vendor-specific mechanism where co identifies the vendor and type identifies the action (not reserved).
The UP.Browser does not currently support this attribute value

X-*, x-*  

Future use (not reserved).
The UP.Browser does not currently support this attribute value

None of these type values imply a specific user interface mechanism. Some devices map each type to a physical key, while others map them to context-dependent gestures (for example, pressing or press-holding a jog shuttle). Thus, when designing your user interface, keep in mind that you cannot specify (or assume) the particular mechanism that a device will use.

NOTE     If you define multiple <do> elements of the same type in one card, you should specify the name attribute for each <do> element to uniquely identify each instance of the same type.



<em> element

The <em> element specifies emphasized text.


Syntax

where text is the text to display in emphasized font.


IMPORTANT     The UP.Browser software does not currently support this element.



<fieldset> element

The <fieldset> element allows you to group multiple text or input items within a card. Specifying one or more <fieldset> elements lets you control how the device presents card content in order to simplify user navigation.


Syntax

where content represents the items to group together and consists of one or more of the following elements:

control  

You can specify any of the following elements in a <fieldset> group: 

 

 
<fieldset>
<input>
<select>
 

(a nested <fieldset>)
(see <input> element)
(see <select> element

text  

You can also specify formatted text in a <fieldset> group. The device uses this text in different ways depending on the elements you specify (for example, to prompt the user for input or describe various options). 

Devices display these elements in the order in which you specify them.


Attributes

title
(optional)  

Specifies a brief label for the <fieldset> group. Some devices use the label as a title when displaying the <fieldset> content. Others might use it as a label for a user interface mechanism that lets the user navigate to the <fieldset> content. For example, if a device cannot display all card content on one screen and ordered="true" (see Order options), the UP.Browser uses the title to identify this group of items on a summary-level menu. 



<go> element

The <go> element is a task element that instructs the device to open a specified URL. If the URL specifies a particular card, the device displays that card. If the URL specifies a deck, the device displays the first card in that deck.


Syntax

where content represents the variables to set when opening the specified URL:

content  

You can optionally specify one or more variables in a <go> statement: 

 

 
<setvar>  

(see <setvar> element


IMPORTANT     Unlike other WML elements that have content, specifying content for the <go> element is optional. If you do not specify any content, you must use the syntax <go attributes/> rather than <go attributes>content</go>.


Attributes

href
(required)  

The URL to open. 

send
referer
(optional)  

true | false  

Specifies whether the device should include the deck URL in the URL request. Specifying sendreferer="true" causes the device to set the HTTP_REFERER header to the relative URL of the requesting deck. If you want to restrict access to trusted services, decks that request specified URLs must set this option to TRUE

method
(optional)  

get | post  

Specifies the HTTP submission method. Specifying method="post" causes the UP.Link Server to transcode variable data to the character set specified by the HTTP headers defined in your application. You should perform this transcoding if non-ASCII characters (specifically UTF-8) may exist in the data being passed. For more information on character sets and HTTP headers, see the UP.SDK Developer's Guide. If you do not specify the method attribute but do specify the postfield nested element, the device automatically uses the post method. 

accept-charset
(optional)  

Specifies the character encodings that your application can handle. The device uses this attribute to transcode data specified by the postfield element. The UP.Link Server assumes UTF-8 as the default encoding (of which US-ASCII is a subset), so WML services in the United States, Canada, or Australia do not need to use this attribute. You can also omit this attribute if you specify your character set(s) in the HTTP response header. Note that the accept-charset attribute overrides any character encodings you specify in the HTTP header. 

The syntax for this attribute is a comma- or space-delimited list of IANA character sets. For example, accept-charset="UTF-8, US-ASCII, ISO-8859-1"

  • For a list of UP.Link-supported encoding names, see the UP.SDK Developer's Guide
  • To view the complete IANA Character Set registry, go to http://www.iana.org/


Example

The following WML code illustrates the syntax for the <go> element:



<head> element

The <head> element specifies information about the deck as a whole, including metadata and access control information.


Syntax

where content represents deck-level header information:

content  

You can optionally specify either of the following elements in a WML deck header: 

 

 
<access>
<meta>
 

one only
one or more 

(see <access> element)
(see <meta> element


Example

The following example illustrates how to specify the maximum age of a deck. The WML definition includes a <meta> statement that uses cache-control within the <head> element



<i> element

The <i> element specifies italic text.


Syntax

where text is the text to display in italic font.


Example

The following WML defines the card shown in Figure 2-5.

Figure  2-5.     Card containing italic text



<img> element

The <img> element instructs the device to display an image within formatted text. Note that not all devices can display images.

NOTE     You cannot embed images inside <do> or <option> elements--in other words, you cannot use images as function key labels or menu items.


Syntax


Attributes

alt
(required)  

Specifies the text to display if the device does not support images or cannot find the specified image. 

src
(required)  

The URL of the image to display. If you specify a valid icon for the localsrc attribute (see below), the device ignores this attribute. 

localsrc
(optional)  

The name of a known icon. If the device cannot find the icon in ROM (Read-Only Memory), it attempts to retrieve it from the UP.Link Server. If you specify a valid icon (see Figure 2-6 for a list of icon names), the device ignores the src attribute (see above). 

align
(optional)  

top | middle | bottom  

Specifies image alignment relative to the current line of text. 

height
(optional)  

The UP.Browser software does not currently support this attribute

width
(optional)  

The UP.Browser software does not currently support this attribute

vspace
(optional)  

The UP.Browser software does not currently support this attribute

hspace
(optional)  

The UP.Browser software does not currently support this attribute

Figure  2-6.     Icon names


Example

The following WML deck generates the display shown in Figure 2-7:

Figure  2-7.     Card containing localsrc icon

NOTE     Some localsrc icons have different forms when displayed at different font sizes. Since you cannot control the display size, keep in mind that the appearance of these icons may vary slightly on different devices.



<input> element

The <input> element lets the user enter text which the device assigns to a specified variable. You can, if desired, also specify a default value for the entry.


Syntax

where text represents the text and/or image the device will display to prompt the user for entry.


Attributes

name
(required)  

The name of the variable in which the device stores the text entered by the user. If the variable has no value, the device sets it to the value specified for the default attribute. If you do not specify a default value, the device initializes the variable to an empty string (""). 

When the device displays the <input> element, the value in the specified variable appears in the entry field. 

title
(optional)  

Specifies a brief label for the input item. Some devices use the label as a tooltip when displaying the input field. Others might use it as a label for a user interface mechanism that lets the user navigate to the item. For example, if a device cannot display all card content on one screen and ordered="true" (see Order options), the UP.Browser uses the title to identify this input item on a summary-level menu. 

type
(optional)  

text | password  

Specifies how the device should display text the user enters. Specifying type="text" causes the text to be visible. Specifying type="password" causes the text to be masked (for example, replaced by "*" characters). Note that the password mode is not encrypted so you should not rely on it for securing critical data. 

value
(optional)  

This attribute is identical in syntax and behavior to the default attribute (see below)

default
(optional)  

A string specifying the default value for the variable specified by the name attribute. 

If the name attribute already has a value when the user navigates to the <input> element, the device ignores the default attribute. If the name attribute does not already have a value, the device sets it to the value specified by the default attribute. 

If you specify a value that does not conform to the format specified by the format attribute, the device ignores the default attribute. 

format
(optional)  

Specifies a data format that the user entry must match (see Specifying a format mask below). If you omit this attribute, the device assumes *M (default uppercase first character followed by up to maxlength number of mixed case alphabetic and numeric characters). 

emptyok
(optional)  

true | false  

Specifies whether the user can leave the field blank. Specifying emptyok="true" indicates that the field is optional--if the user enters a value, however, the device applies any entry requirements you specify for the format attribute (see above). 

size
(optional)  

The UP.Browser software does not currently support this attribute

maxlength
(optional)  

Specifies the maximum number of characters the user can enter. If you do not specify the maxlength attribute, the UP.Browser imposes a limit of 256 characters. 

tabindex
(optional)  

The UP.Browser software does not currently support this attribute


Specifying a format mask

You can specify the following values for the format attribute:

Tag  Description 
A  

Any symbolic or uppercase alphabetic character (no numbers) 

a  

Any symbolic or lowercase alphabetic character (no numbers) 

N  

Any numeric character (no symbols or alphabetic characters) 

X  

Any symbolic, numeric, or uppercase alphabetic character (not changeable to lowercase) 

x  

Any symbolic, numeric, or lowercase alphabetic character (not changeable to uppercase) 

M  

Any symbolic, numeric, or uppercase alphabetic character (changeable to lowercase)--for multiple character input, defaults to uppercase first character 

m  

Any symbolic, numeric, or lowercase alphabetic character (changeable to uppercase)--for multiple character input, defaults to lowercase first character 


Example



<meta> element

The <meta> element provides meta information for a WML deck. This element is specified within the deck header along with any access control information for the deck (for more information, see <access> element and <head> element). Note that not all devices support every meta information type.


Syntax


Attributes

property
(required)  

You must specify one of the following attributes: 

name="name"
http-equiv="name"
user-agent="agent"  

  • If you specify the name attribute, the UP.Link Server ignores the metadata. 
  • If you specify the http-equiv attribute, the UP.Link Server converts the metadata to an HTTP response header. 
  • If you specify the user-agent attribute, the UP.Link Server simply passes the metadata to the device. 

content
(required)  

Specifies the metadata value associated with the property attribute. 

scheme
(optional)  

The UP.Browser software does not currently support this attribute

forua 

(optional) 

true | false 

Specifies that the author intended the property to reach the user agent. If forua="false", an intermediate agent must remove the <meta> element before the document is sent to the client. If the value is "true", the metadata of the element must be delivered to the user agent. The method of delivery may vary. For example, http-equiv metadata may be delivered using HTTP or WSP headers. 

The 3.1 UP.Browser supports the following meta information types.


Cache control

Like conventional Web browsers, the UP.Phone has a memory cache. It caches each deck that the user visits in order to quickly redisplay it without requesting it from the UP.Link Server again. The length of time that a device keeps a deck in cache is called the time to live (TTL). The default UP.Phone TTL is 30 days (or until memory is exhausted). If a deck contains time-sensitive information, you can specify a shorter TTL so that the device will reload the deck from the server more frequently. The following example illustrates how to use a <meta> statement to set the TTL:

The max-age parameter specifies the time (in seconds) to cache the deck. The example above instructs the device to drop the deck from the cache after 1 hour (3600 seconds). To determine the right TTL for a deck, you should balance the time-sensitivity of the information with the degradation in response time caused by reloading information from the server. Setting max-age to zero causes the UP.Browser to reload the deck every time the user navigates to it in a forward direction; however, if the user navigates back to the deck, the UP.Browser displays the card from the information in cache.


Bookmarks

UP.Phone bookmarks are similar to conventional Web browser bookmarks. When a user bookmarks a card, the UP.Browser creates a bookmark that consists of two items:

Because all decks are now bookmarkable by default, the markable <meta> element is only used to turn off bookmarking for a deck. The syntax for the statement is as follows:

When a user bookmarks a card, the UP.Browser automatically sets the bookmark URL to the URL for the deck. If you want to use a different URL, you can specify another <meta> element in the deck header using the following syntax:

where url is the URL you want to use for the bookmark.



<noop> element

The <noop> element is a task element that instructs the device to do nothing, i.e. "no operation." This element is useful for overriding deck-level <do> elements, called shadowing (see the UP.SDK Developer's Guide for more information on shadowing).


Syntax



<onevent> element

The <onevent> element associates a state transition, or intrinsic event, with a task. When the intrinsic event occurs, the device performs the associated <onevent> task.


Syntax

where task represents the action to perform when the intrinsic event occurs:

task  

You can specify any one of the following actions for the <onevent> element: 

 

 
<go>
<prev>
<noop>
<refresh>
 

(see <go> element)
(see <prev> element)
(see <noop> element)
(see <refresh> element


Attributes

type
(required)  

Identifies the intrinsic event that triggers the specified <onevent> task (see descriptions below). If a card-level <onevent> element (i.e. defined within a <card> element) has the same type as a deck-level <onevent> element (i.e. defined within a <template> element), the card-level binding overrides the deck-level binding. 

You can specify the following values for the type attribute:

type value  Perform task if ... 
onpick  

User selects or deselects an <option> item (see <option> element). 

onenterforward  

User navigates to a card through a <go> task. 

onenterbackward  

User navigates to a card through a <prev> task or invokes the PREV mechanism (for example, presses the BACK key). 

ontimer  

A specified <timer> element expires (see <timer> element). 



<optgroup> element

The <optgroup> element allows you to group multiple <option> (or nested <optgroup>) elements within a card. Creating option groups lets you specify control information about how the device should present the card content.


Syntax

where content represents one or more of the following:

content  

You can specify any of the following elements: 

 

 
<optgroup>
<option>
 

(a nested <optgroup> element)
(see <option> element

Devices display these elements in the order in which you specify them.


Attributes

title
(optional)  

Specifies a brief label for the <optgroup> group. Some devices use the label as a title when displaying the <optgroup> content. Others might use it as a label for a user interface mechanism that lets the user navigate to the <optgroup> content. 


IMPORTANT     The UP.Browser software does not currently support this element.



<option> element

The <option> element specifies a particular choice within a <select> element.


Syntax

where content represents the text the device will display to represent the particular selection item and the action to perform if the user selects it:

event  

You can optionally specify the following element in your item definition: 

 

 
<onevent>  

(see <onevent> element

text  

The device displays this text to represent the selection item. 


Attributes

title
(optional)  

A label that identifies the option. The UP.Browser uses the title as the ACCEPT key label when the user selects the option. To ensure compatibility on a wide range of devices, label should be a maximum of five characters. 

value
(optional)  

Specifies the value to assign to the variable defined in the <select> element name attribute if the user selects the option (see example). If you specify a variable reference, the device evaluates the reference before setting the name variable. 

onpick
(optional)  

Specifies the URL to open if the user selects the option (or deselects it if the <select> element allows multiple choices). This attribute represents an abbreviated form of the <onevent> element. 


Example

In the following example, selecting an item sets the variable color to the value associated with that item (i.e. 1, 2, 3, or 4).



<p> element

The <p> element specifies a new paragraph and has alignment and line-wrapping attributes.


Syntax


Attributes

align
(optional)  

left | right | center  

Specifies line alignment relative to the display area. Specifying <p> without the align attribute resets the line to left alignment. 

mode
(optional)  

wrap | nowrap  

Specifies text wrapping mode to use. If you specify nowrap, the device uses another mechanism, such as horizontal scrolling, to display long lines to the user. The device continues to use the mode you specify until you specify a <p> element with the other mode. In other words, 

  • If you specify the mode attribute, the device applies that mode. 
  • If you do not specify the mode attribute, the device applies the last-specified mode value. If no previous <p> element exists, the device applies the default mode (wrap). 



<postfield> element

The <postfield> element defines name/value pairs that are passed to the HTTP server receiving the <go> request. See the <go> element for an example of the <postfield> element's use in WML.


Syntax


Attributes

name
(required)  

A label that identifies the field. 

value
(required)  

A string specifying the default value for the variable specified by the value attribute. 



<prev> element

The <prev> element is a task element that instructs the device to remove the current URL from the history stack and open the previous URL. If no previous URL exists on the history stack, specifying <prev> has no effect.


Syntax

where content represents the variables to set when opening the previous URL:

content  

You can optionally specify one or more variables in a <prev> statement: 

 

 
<setvar>  

(see <setvar> element


IMPORTANT     Unlike other WML elements that have content, specifying content for the <prev> element is optional. If you do not specify any content, you must use the syntax <prev/> rather than <prev>content</prev>.


Example

The following WML illustrates a <prev> element that does not contain any content.

Figure  2-8.     Card with ACCEPT key bound to <prev> task



<refresh> element

The <refresh> element is a task element that instructs the device to refresh the specified card variables. The device also refreshes the display if any of those variables are currently shown.


Syntax

where content represents the variables to refresh:

content  

You must specify at least one variable in a <refresh> statement: 

 

 
<var>  

(see <setvar> element


Example

The following WML builds on the example shown in Example by adding a "Clear" option that lets the user clear the First Name and Last Name fields in order to enter new search criteria. The code specifies a second <do> element that uses <refresh> to reset the first and last variables to NULL when the user presses the OPTIONS key. Figure 2-9 illustrates how the card appears on the device.

Figure  2-9.     Card with OPTIONS key bound to <refresh> task

NOTE     You can use the <refresh> element to set variables to any values, not just to "reset" them to NULL as shown in this example.



<select> element

The <select> element specifies a list of options from which the user can choose. You can specify either single- or multiple-choice <select> elements.


Syntax

where text represents the text and/or image the device will display to prompt the user for selection and content represents the list of items from which to choose. You can define selection content using one or more of the following elements:

content  

You can specify either of the following elements in a <select> list: 

 

 
<optgroup>
<option>
 

(not currently supported by the UP.Browser)
(see <option> element

Devices display these elements in the order in which you specify them.


Attributes

title
(optional)  

Specifies a brief label for the <select> list. Some devices use the label as a title when displaying the <select> content. Others might use it as a label for a user interface mechanism that lets the user navigate to the <select> content. For example, if a device cannot display all card content on one screen and ordered="true" (see Order options), the UP.Browser uses the title to identify this select list on a summary-level menu. 

multiple
(optional)  

true | false  

Specifies whether the user can select multiple items. 

name
(optional)  

The name of the variable in which the device stores the value(s) associated with the option(s) chosen by the user. The value associated with each option comes from the <option> element value attribute. 

The value(s) in the specified variable determine the default selection(s) when the device displays the <select> element. If the variable has no value, the device sets it to the value(s) specified for the default attribute. If you do not specify a default value, the device initializes the variable to an empty string (""). 

In the case of multiple selections, the values are stored as a semicolon-separated list (see example). 

default
(optional)  

A string specifying the default value(s) for the variable specified by the name attribute. 

If the name attribute already has a value when the user navigates to the <select> element, the device ignores the default attribute. If the name attribute does not already have a value, the device sets it to the value specified by the default attribute. 

iname
(optional)  

Identical to the name attribute except for the following: 

  • The specified variable stores the index value(s) associated with the option(s) chosen by the user. The index value associated with each option comes from its position in the <select> list, starting with 1. If the user has not selected an option, the index value is 0
  • The default value is specified by the ivalue attribute. 

ivalue
(optional)  

Identical to the default attribute except for the following: 

  • The specified string contains the default index value(s) for the variable specified by the iname attribute. 

tabindex
(optional)  

The UP.Browser software does not currently support this attribute


Example

In the following example, "Dog" and "Cat" are the default selections if the variable i has no value when the device displays the card. Choosing "Cat" and "Horse" sets the variable x to the value "C;H" and the variable i to the value "2;3".



<setvar> element

The <setvar> element sets a variable to a specified value when the device executes a <go>, <prev>, or <refresh> task.


Syntax


Attributes

name
(required)  

The name of the variable to set. The device ignores the <setvar> element if name does not evaluate to a known variable at runtime. 

value
(required)  

The value to assign to the variable. 



<small> element

The <small> element specifies small font text.


Syntax

where text is the text to display in small font.


IMPORTANT     The UP.Browser software does not currently support this element.



<strong> element

The <strong> element specifies strongly emphasized text.


Syntax

where text is the text to display in strongly emphasized font.


IMPORTANT     The UP.Browser software does not currently support this element.



<table> element

The <table> element allows you to specify columnar format. You can control the overall alignment of the table, but not the alignment of individual cells. WML tables are similar to HTML tables but with fewer capabilities.

When defining a table, you have to declare the number of columns, followed by some content. The content can include empty rows and columns.


Syntax


Attributes

align
(optional)  

left | right | center  

Specifies text alignment relative to the column. If you do not specify the align attribute, the text is automatically left-aligned. 

title 

Specifies a label for the table. 

columns 

Specifies the number of columns for the row set. Specifying a zero value for this attribute is not allowed. 


Example



<td> element

The <td> element is used as a container to hold a single table cell data within a table row. Table data cells may be empty. The user agent should do a best effort to deal with multiple line data cells that may result from using images or line breaks.


Syntax

where content represents text inside the table cell, or the <img> or <anchor> elements.

content  

You can specify either of the following elements in a <td> element: 

 

 
<img>
<anchor>
 

(see <img> element)
(see <anchor> element



<tr> element

The <tr> element is used as a container to hold a single table row. Table rows may be empty, in other words, all cells are empty.


Syntax

where content represents text inside the table cell, or the <img> or <anchor> elements.



<template> element

A WML deck may contain a <template> element that defines deck-level event bindings, i.e. characteristics that apply to all cards in the deck. You can override these characteristics for a particular card by specifying the same event bindings within the <card> definition (see <card> element).


Syntax

where content represents the general action to take when particular events occur:

content  

You can specify either of the following elements in a template definition: 

 

 
<do>
<onevent>
 

(see <do> element)
(see <onevent> element


Attributes

onenter
forward
(optional)  

Specifies the URL to open if the user navigates to a card through a <go> task. This attribute represents an abbreviated form of the <onevent> element (see Example 2). 

onenter
backward
(optional)  

Specifies the URL to open if the user navigates to a card through a <prev> task. This attribute represents an abbreviated form of the <onevent> element (see Example 2). 

ontimer
(optional)  

Specifies the URL to open if a specified <timer> element expires. This attribute represents an abbreviated form of the <onevent> element (see Example 2). 



<timer> element

The <timer> element provides a method for invoking a task automatically after some period of user inactivity. Any task or user action that activates the card starts the timer, and executing any task element stops it. You can only associate one task per timer, and you can only define one timer per card.


Syntax


Attributes

name
(optional)  

The name of the variable in which the device stores the timer value. If the variable has no value when the timer is initialized, the device sets it to the value specified for the default attribute. The device sets this variable to either the current timer value when the user exits the card or 0 if the timer expires. 

value
(required)  

A string specifying the value for the variable specified by the key attribute. You must specify <timer> values in units of 1/10 seconds--so, for example, a value of 100 equals 10 seconds. Specifying a value of 0 disables the timer. 

If the name attribute already has a value when the timer is initialized, the device ignores the default attribute. If the name attribute does not already have a value, the device sets it to the value specified by the value attribute. 


Example

The following example illustrates how a timer can initialize and reuse a counter. The device resets the timer to the value of the time variable each time the user navigates to the card. If time has no value, the device sets the timer to 5 seconds. When the timer expires, the device automatically displays the second card in the deck.



<u> element

The <u> element specifies underlined text.


Syntax

where text is the text to display in underlined font.


IMPORTANT     The UP.Browser software does not currently support this element.



<wml> element

The <wml> element specifies a WML deck.


Syntax

where content represents the WML elements that define the actions of the deck.


Attributes

xml:lang
(optional)  

Specifies the natural or formal language for the WML document. Specifying the xml:lang attribute overrides any other language specification for the document. See the formal XML specification "Extensible Markup Language (XML), W3C Proposed Recommendation," at http://www.w3.org for more information about specifying a language value. 

The UP.Browser software does not currently support this attribute


Example


[Cover] [Previous Section] [Next Section] [Index]


Copyright © 1999, Phone.com Inc. All rights reserved.
Please send comments and questions to doc-comments@corp.phone.com.