The Textarea Tag
The textarea tag creates a multiple lined text input field in your reader's
browser. It allows the reader to type in nearly unlimited lines of text.
When the form is submitted, these lines are sent to the server as the value of the name of the
textarea. If your reader hits enter in the field, it is sent to the server as (CR/LF). The textarea
tag must always be followed by the closing </textarea> tag.
This tag has several commonly used attributes:
- cols
- rows
- name (required)
- wrap
cols
The cols attribute indicates how many columns wide the textarea should be.
rows
The rows attribute defines how many rows down the textarea should be.
Neither cols, nor rows are required attributes, but in order to keep your layout I strongly
recommend that you set them. You will find that your readers will not want to type more than
there is space available (even though there are scroll bars to include additional text), so
this is a good way to limit the text submitted by a small amount.
wrap
There are three values for the wrap attribute,virtual,physical, andoff. Off is the
default value. This defines how the text behaves within the textarea space.
wrap="off" provides no wrapping. Unless your readers hit <ENTER>, the text
they type in will scroll along on one long line. The text will be sent to the server as one long
line unless the reader hits the carriage return key.
This is an example of a textarea field where the wrap is turned off.
wrap="virtual" wraps the text within the space of the text box, but sends it to the
server as one long line, as if no wrapping occurred.
This is an example of a textarea field where the wrap is virtual.
wrap="physical" wraps the text within the text box, and sends it to the server
exactly as the reader sees it in the text box.
This is an example of a textarea field where the wrap is physical.
You can also use style tags on textarea boxes with thestyleandclassattributes. And JavaScript
uses the event handlersonFocus,onBlur,onChange, andonSelect. You use these attributes as you would
use them in any other HTML tag.
I hope this came in useful!
Ask in the forum
if you have any suggestions or comments.