Tutorial 13: Giving Form to Forms - HTML with Style | 7 | WebReference

Tutorial 13: Giving Form to Forms - HTML with Style | 7


Tutorial 13: Giving Form to Forms

Multi-line text boxes with the TEXTAREA element

Another element that is used to create form controls is the TEXTAREA element, which is very similar to an INPUT element with TYPE="text", with the exception that TEXTAREA elements define multi-line text boxes.

The TEXTAREA element

Can only appear inside a FORM element
Can only contain text, and no other elements. The contents of the element form its default value
Both start-tag and end-tag are required.

Attributes for the TEXTAREA element

NAME (Name)
The name that will be used for the name/value pair that the control creates.
ROWS (Integer)
The number of rows of text that the control can display at one time.
COLS (Integer)
The number of columns of text that the control can display at one time.
Read-only control attribute
Disabled control attribute
Identifier and classification attributes
Language information attributes
Title attribute
Inline style information attribute
Text alignment attribute
Tabbing navigation attribute
Accessibility key attribute
Intrinsic event handler attributes
<FORM ACTION="/cgi-bin/html/formdump.cgi" 
      METHOD="GET" ENCTYPE="application/x-www-form-urlencoded">
<TEXTAREA NAME="comments" ROWS="5" COLS="40">
This is a text area with 5 rows and 40
columns visible by default. The text
inside the element is its default value.
Although the control is limited in size,
the text entered can be larger than this
size, and the user agent will presumably
offer a scrolling mechanism for it.
<INPUT TYPE="submit">

The TEXTAREA element is very similar to a normal text box. It takes its name from the NAME attribute, its initial value from its contents and its final value from whatever the user types into the text box. You can also set the size of the text box using the ROWS and COLS attributes.


Produced by Stephanos Piperoglou

URL: http://www.webreference.com/html/tutorial13/14.html

Created: May 28, 1998
Revised: February 25, 1999