At least the Nokia
WML Reference docs are a bit unclear on the use of the format parameter in the
<input/> tag. The format parameter controls the type and format of characters the
user is allowed to input.
Note that not all WAP 1.1
browsers accept all formatting codes. The Nokia 7110 for instance has very poor support.
The Mitsubishi Trium has a slight problem with the *f code, where *
must 1 or greater.
The formatting codes specify the
following
A means any uppercase alphabetic (non numeric) or punctuation characters
a means any lowercase alphabetic (non numeric) or punctuation characters
N means any numeric character
X means any uppercase character
x means any lowercase character
M means any character, input mode starts in uppercase mode
m means any character, input mode starts in lowecase mode
*f (asterisk) means any number of (including 0) characters, where f is a format
code
nf means exactly n number (1-9) of characters, where f is a format code
\ is used for displaying (escaping) non formatting codes in the input string
The formatting characters
can also be combined to force a certain type of input, however forcing a certain input
should be avoided since there is no error messages when the user attempts to input an
incorrect format. If the input is incorrect, the field might on some browsers simply
remain blank. At least let the user know what to type. Also remember to help the user as
much as possible. If you only want numeric input, use the "*N" format which will
switch the input mode to numeric input. If you only want uppercase characters, use the
"*M" format to switch to uppercase input.
Some examples:
"N" means that you will only accept one single numeric character
"*N" means that you will accept any number of numeric characters
"NN" means that you will only accept two numeric digits. No more, no less
"ANN" means that you will accept any single uppercase alphabetic (non numeric) character,
followed by two digits. No more, no less
"X*N" means that you will accept any single alphabetic (non numeric) character, followed by
any number of numeric digits
"*M" means that you will accept any number of any characters (numeric and non numeric),
and the input mode will start in uppercase
"NNN\-NNN\-NNNN" means that you will accept a US type phone number format, eg. "123-456-1234"
"2N\:2N\:2N" means that you will accept a typical time format, eg. "12:02:34"
"NNNNNNNNN" means you will accept a 9 digit number
"9N" means you will accept a 9 digit number
|
|