
|
 |

Accepting user input

You can create boxes on a WAP page for a
person to enter some information, such as an e-mail address, a password or
personal details.
The tag to use is the <input>
tag and it has several properties that need to be defined. Firstly, it must
have a name so that you can use the information that is entered.
Secondly, it must have a type, and that can be either "text"
or "password". If you select the password option, then the user will
see their entry masked, usually by an asterix (*).
The final setting that is likely
to be used is the format, which is optional, you do not have to use it.
This enables you to control what type of information can be entered, and the
types allowed are as follows...
A |
|
Allows any uppercase
letter |
a |
|
Allows any lowercase
letter |
N |
|
Allows any number |
X |
|
Allows any uppercase
character (symbol, letter, number) |
x |
|
Allows any lowercase
character (symbol, letter, number) |
*f |
|
Allows any number of
characters of format f (e.g. *X) |
nf |
|
Allows n
characters of format f (e.g. 5a) |
|
|
|
When not using * and f,
you must repeat the codes for each charcter permitted (e.g. AANN will
allow DE12 as an input, but not 1234) |
|
|
|
If no format is specified
then an unlimited number of any characters can be typed in by the
user. |
What you do with the selected
items is to usually go to a particular page, but it can also be used to send
values to a WMLScript, but we are not dealing with that yet.
An example follows...
<?xml
version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<wml>
<card id="MainCard" title="This is a
first card">
<p align="center">
This is a sample text
<br/><br/>
Name : <input name="title"
type="text"/>
Age : <input name="age"
type="text" format="NN"/>
</p>
</card>
</wml> |
|

|