Web design creating cool web sites with html, xhtml, and css

Page 224

Chapter 9: Forms, User Input, and the Common Gateway Interface

Tag

Close Tag

Meaning

197

name=”name”

Specifies the symbolic name of a field value

size=”x”

Determines whether it’s a pop up (size=1, the default) or a multiline scrolling region

multiple=”multiple”

Enables users to select more than one value

<option

</option>

Indicates individual values within the select range

value=”x”

Returns the value of the specified menu item

selected=”selected”

Denotes the default value in the list

<textarea

</textarea> Specifies a multiline text-entry field

name=”x”

Specifies the symbolic name of a field value

rows=”x”

Indicates the number of rows (lines) in the textarea space

cols=”x”

Indicates the number of columns in the textarea space

wrap=”x”

Specifies the type of word wrap within the textarea (virtual is typical, which shows words wrapping but sends them as a single long line when submitted)

The sheer number of different attributes within the input tag can be confusing, but you can understand the overloaded tag if you know that the original design for forms had all possible input specified as variants to input. It didn’t quite work out, however, because two types of information, drop-down lists and text area boxes, ended up spilling out as their own tags: select and textarea. Current Web browsers support nine different input types, each of which produces a different type of output. Here are the user input types: • text: The default, with size used to specify the default size of the box that is created and maxlength used to indicate the maximum number of characters the user is allowed to enter. • password: A text field with the user input displayed as asterisks or bullets for security. Again, size specifies the displayed input-box size and maxlength can be used to specify the maximum number of characters allowed. • checkbox: Offers a single (ungrouped) check box; the checked attribute enables you to specify whether the box should be checked by default. The value attribute can be used to specify the text associated with the check box. • hidden: Enables you to send information to the program processing the user input with­ out the user actually seeing it on the display. This type is particularly useful if the page with the HTML form is automatically generated by a CGI script. • file: Provides a way for users to actually submit files to the server. Users can either type the filename or click the Browse button to select the file from the PC. • radio: Displays a toggle button; different radio buttons with the same name= value are grouped automatically so that only one button in the group can be selected at a time.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.