WML <input> Tag

Advertisements


The <input/> element is used to create input fields and input fields are used to obtain alphanumeric data from users.

Attributes:

This element supports the following attributes:

AttributeValueDescription
nametextThe name of the variable that is set with the result of the user's input
maxlengthnumberSets 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"
formatA
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 the f with one of the letters above to specify what characters the user can enter
nf = Replace the n with a number from 1 to 9 to specify the number of characters the user can enter. Replace the f with one of the letters above to specify what characters the user can enter

sizenumberSets the width of the input field
tabindexnumberSets the tabbing position for the select element
titletextSets 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.
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="Input Fields">
<p> Enter Following Information:<br/> 
 Name: <input name="name" size="12"/>
 Age :  <input name="age" size="12" format="*N"/>
 Sex :  <input name="sex" size="12"/> 
</p>
</card>

</wml>

This will provide you the following screen to enter required information:

WAP Example 23


Advertisements
Advertisements