Wap/WML : Fill in forms
Contents ]
François Houste

Input Fields

There are two means of collecting data from visitors by using WML. The first is to provide them with a text input field for free input. To a certain extent, this kind of area behaves like the text input control used in HTML. Besides, it is coded with the <input /> tag common to both languages.

To define an input field for collecting a visitor's user id, you would use the following code:

<p>
Identifiant :<br/>
<input type="text" title="User name" name="Ident"/><br/>
</p>

This code will produce the following result when the WML deck is displayed. First, the input field is delineated by two brackets. Once the input is activated, the field occupies the whole display area to allow the visitor to enter data.



Figure 1: An input field

As you can see, the <input /> tag requires several parameters. Only three have been used here and only one is mandatory:

  • name: This is the only mandatory attribute. It is used to assign a name to the input area. This name is then used to identify the field when the data are validated.

  • type: This attribute affects the way in which the data are displayed on the WAP device's screen when they are entered. With the value text, the input is visible. With the value password, the input is hidden and replaced by a series of stars (****).

  • title: This is the title of the input field. It appears on the screen of the mobile device when the visitor enters data.



1   2   3   4   5