(Site Identification)

'Eye' Focus: Web Support Tutorials

Forms: INPUT Tag


The INPUT tag accepts some form of information from the user. This information is transmitted to the server when the form is submitted.

Syntax: (skip code)
<input type="..." name="..." size="..." maxlength="..." value="...">

(to Top) Definitions


TYPE:

TYPE defines one of the various types of input fields which are recognized in the HTML specification. The TEXT input type allows the user to enter or edit a single line of text in that field.

The TYPE can include the following:
text (the default), password, select, checkbox, radio, image, button, submit, reset, hidden, and file.

A good explanation of the options for the INPUT element and what browsers support them can be found at IndexDOT.

NAME:

NAME labels the data provided in that field. The program which processes the form references to the data's name to determine what it is to do with that data. The NAME must begin with a letter and can contain any number of alphanumeric characters, dashes, or underscores (it cannot contain any spaces).

SIZE and MAXLENGTH:

The SIZE and MAXLENGTH defines the appearance and function of the field. Let's say that the field SIZE is 50. This means that the user can type up to 50 characters which can be viewed in the field at one time. However, the user could still type more than 50 characters in the field and the browser will just scroll the text in the window. You can limit the length of the text that can be entered by the user by including a MAXLENGTH="N" (where N is the maximum number of characters).

VALUE:

The VALUE is used when you wish to provide a default value for the field. This attribute can be left blank or omitted if you want the visitor to provide the value.


[Updated: Sunday, November 18, 2007]