WML Inputs - WML

What are WML inputs?

WML offers different options to access user information through WAP application.
Lets’ find different options to enable the user to make straight choices between items. These may be include different forms like menus and submenus, allowing users to drill down to the exact data that they want.

WML <select> Element:

The <select>...</select> WML elements can be used to enable a selection list and the <option>...</option> tags are used to define an item in a selection list. Here various items are presented as radiobuttons in some WAP browsers. The <option>...</option> tag pair should be added within the <select>...</select> tags.
The following element support the following attributes:
Attribute Value Description
iname text Names the variable that is set with the index result of the selection
ivalue text Sets the pre-selected option element
multiple
  • true
  • false
Sets whether multiple items can be selected. Default is "false"
name text Names the variable that is set with the result of the selection
tabindex number Sets the tabbing position for the select element
title text Sets a title for the list
value text Sets the default value of the variable in the "name" attribute
xml:lang language_code Sets the language used in the element
class class data Sets a class name for the element.
id element ID A unique ID for the element
Following is the example showing usage of these two elements.
After loading this program, it will show you the following screen:
wap-example21
After highlighting enter on the options, it will display the following screen:
wap-example22
If you want to add an option to select multiple options, then set multipleattribute to true as follows:
This will give you a screen to select multiple options as follows:
wap-example24

WML <input> Element:

The <input/> element is used to define various input fields. While input fields are used to get alphanumeric data from users.
This element support the following attributes:
Attribute Value Description
name text The name of the variable that is set with the result of the user's input
maxlength number Sets the maximum number of characters the user can enter in the field
emptyok
  • true
  • false
Sets whether the user can leave the input field blank or not. Default is "false"
format A
a
N
X
x
M
m
*f
nf
Sets the data format for the input field. Default is "*M".

A = uppercase alphabetic or punctuation characters
a = lowercase alphabetic or punctuation characters
N = numeric characters
X = uppercase characters
x = lowercase characters
M = all characters
m = all characters
*f= Any number of characters. Replace thefwith one of the letters above to specify what characters the user can enter
nf= Replace thenwith a number from 1 to 9 to specify the number of characters the user can enter. Replace thefwith one of the letters above to specify what characters the user can enter

size number Sets the width of the input field
tabindex number Sets the tabbing position for the select element
title text Sets a title for the list
type
  • text
  • password
Indicates the type of the input field. The default value is "text". Password field is used to take password for authentication purpose.
value text Sets the default value of the variable in the "name" attribute
xml:lang language_code Sets the language used in the element
class class data Sets a class name for the element.
id element ID A unique ID for the element.
.
Following is the example showing usage of this element.
This will provide you the following screen to enter required information:
wap-example23

WML <fieldset> Element:

The <fieldset/> element is developed to group various input fields or selectable lists.
This element support the following attributes:
Attribute Value Description
title text Sets a title for the list
xml:lang language_code Sets the language used in the element
class class data Sets a class name for the element.
id element ID A unique ID for the element.
Following is the example showing usage of this element.
Following screen is used to enter required information. This result may differ browser to browser.
wap-example25

WML <optgroup> Element

The <optgroup/> element is used to group various options together inside a selectable list.
This element support the following attributes:
Attribute Value Description
title text Sets a title for the list
xml:lang language_code Sets the language used in the element
class class data Sets a class name for the element.
id element ID A unique ID for the element.
Following is the example showing usage of this element.
When a user loads above code, then it will give two options to be selected:
wap-example26
While selecting any of the above options then it will give final options to be selected. So if user selects India, then it will show you following options to be selected:
wap-example27

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WML Topics