INPUT TYPE="TEXT"


The text box allows for one line of text to be entered by the viewer. It uses the following syntax:

<INPUT TYPE="TEXT" NAME="name of variable" VALUE="value" SIZE="size" MAXLENGTH="length">

Where INPUT TYPE="TEXT" specifies the input to be a text box.

The NAME is the name of the variable. For example, NAME="postal_code". The user would input a number or a string of characters and that number or string would be the value assigned to the name of the variable "postal_code".

Only <INPUT TYPE="TEXT" NAME="name of variable"> is required syntax for the text box input. The other attributes are optional.

If the VALUE attribute is specified that value will appear in the text box. This is used to save some typing. The user can override this.

The SIZE attribute denotes the size of the text box. The SIZE is specified in number of characters. The default SIZE varies from browser to browser.

The MAXLENGTH attribute limits the length of the input character string. MAXLENGTH can be greater than SIZE, in which case the text box will scroll, or MAXLENGTH can be less than or equal to SIZE.


Here is a basic example:
Please enter country of residence:<BR>
<INPUT TYPE="TEXT" NAME="country">

It generates a text box that looks like this:
Please enter country of residence:

Here is an example with the options specified:
Please enter country of residence:<BR>
<INPUT TYPE="TEXT" NAME="country" VALUE="United States of America" 
SIZE="24" MAXLENGTH="24">

It generates a text box that looks like this:
Please enter country of residence:

How do I add more than one line of text into a form?

[INDEX] [PREVIOUS] [NEXT PAGE] [CHAPTER 9]

Valid HTML 3.2!