There are many circumstances in which
you want to allow the user to enter more than simply one line of
text. In such a situation, the widget you want to use is the Text
Area. Below is an example Text Area widget.
The previous Text Area widget was
created with the following code:
Notice how you can type in multiple
lines to the text area widget and scroll up and down using the
scroll bar on the right and left and right with the scrollbar on
the bottom.
Notice also, that as usual, the input
widget includes a NAME attribute that will be used for creating
the HTTP body. In the case of the text area widget, the text
that the user types into the widget will be set as the VALUE for
this NAME.
http://Stars.com/Development/Webprog/textarea_widget.html
The Text Area widget also has several
other attributes that affect how it works. The following table
outlines them:
Attribute
Description
NAME
Specifies the variable name associated with this widget
ROWS
Specifies the height of the text area widget
COLS
Specifies the width of the text area widget
WRAP
Specifies the logic of word wrapping. It can be NONE, SOFT or
HARD as explained below
The ROWS and COLS Attributes
Of course, the above text area is not
very easy to use since it is so small. The Text Area widget also
has two attributes that affect the size of the widget. These are
the ROWS and COLS attributes and are best shown by example.
Consider the following text area widget.
The previous Text Area widget was
created with the following code:
The Text Area widget also allows you to
specify how word wrapping will function. You can specify NONE,
SOFT, or HARD word wrapping. SOFT word wrapping means that the
widget will wrap text in the browser windows but will not report
the wrapping information to the server. HARD word wrapping, on
the other hand, will be reported as multiple lines. NONE means
that the text area widget will not wrap text at all.
You have already seen text areas without
word wrapping above since the text area defaults to NONE. But
you have not seen a text area with word wrapping. We will show
you one of those below (notice that if you type a line that is
too long to fit in the text area, it will wrap to the next line
automatically:
The previous Text Area widget was
created with the following code: