(^358) Chapter 9 XHTML Forms
Figure 9.6
The characters
secret999 were
typed, but the
browser displays
***** (Note: your
browser may use a
different symbol to
“hide” the
characters.)
Password Box. The tag configures this form control. The password box is
similar to the text box but it accepts information that needs to be hidden as it is entered,
such as a password. When the user types information in a password box, asterisks (*)
are displayed instead of the characters that have been typed, as shown in Figure 9.6.
This hides the information from someone looking over the shoulder of the person
typing. The actual characters typed are sent to the server and the information is not
really secret or hidden. See Chapter 12 for a discussion of encryption and security.
The XHTML code follows:
Password: <input type="password" name="myPassword"
id="myPassword" />
Common password box attributes are listed in Table 9.3.
Check Box. This form control is configured by the tag and allows the user
to select one or more of a group of predetermined items. A sample check box is shown
in Figure 9.7.
Table 9.3Common password box attributes
Common
Attributes Values Usage
type password Configures the password box.
name Alphanumeric, no spaces,
begins with a letter
Names the form element so that it can be easily accessed by
client-side scripting languages or by server-side processing.
The name should be unique.
id Alphanumeric, no spaces,
begins with a letter
Provides a unique identifier for the form element.
size Numeric Configures the width of the password box as displayed by the
browser. If size is omitted, the browser displays the password box
with its own default size.
maxlength Numeric Optional. Configures the maximum length of data accepted by the
password box.
value Text or numeric
characters
Assigns an initial value to the text box that is displayed by the
browser. Accepts the information typed in the password box. This
value can be accessed by client-side and by server-side processing.
steven felgate
(Steven Felgate)
#1