WML <select> Tag

Advertisements


The <select>...</select> WML elements are used to define a selection list and the <option>...</option> tags are used to define an item in a selection list. Items are presented as radio buttons in some WAP browsers. The <option>...</option> tag pair should be enclosed within the <select>...</select> tags.

Attributes:

This element supports the following attributes:

AttributeValueDescription
inametextNames the variable that is set with the index result of the selection
ivaluetextSets the pre-selected option element
multiple
  • true

  • false

Sets whether multiple items can be selected. Default is "false"
nametextNames the variable that is set with the result of the selection
tabindexnumberSets the tabbing position for the select element
titletextSets a title for the list
valuetextSets the default value of the variable in the "name" attribute
xml:langlanguage_codeSets the language used in the element
classclass dataSets a class name for the element.
idelement IDA unique ID for the element.

Example:

Following is the example showing usage of this element.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">

<wml>

<card title="Selectable List">
<p> Select a Tutorial :
 <select>
  <option value="htm">HTML Tutorial</option>
  <option value="xml">XML Tutorial</option>
  <option value="wap">WAP Tutorial</option>
 </select>
</p>
</card>

</wml>

When you will load this program, it will show you the following screen:

WAP Example 21

Once you highlight and enter on the options, it will display the following screen:

WAP Example 22

You want to provide option to select multiple options, then set multiple attribute to true as follows:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">

<wml>

<card title="Selectable List">
<p> Select a Tutorial :
 <select multiple="true">
  <option value="htm">HTML Tutorial</option>
  <option value="xml">XML Tutorial</option>
  <option value="wap">WAP Tutorial</option>
 </select>
</p>
</card>

</wml>

This will give you a screen to select multiple options as follows:

WAP Example 24


Advertisements
Advertisements