Usage Recommendation
use it if you use Forms

  • NAME: name of this form field
  • COLS: how many characters wide
  • ROWS: how many rows
  • WRAP: how to wrap the text
  • READONLY: don't let the user change the contents of the field
  • DISABLED: don't let the user do anything with this field
  • TABINDEX: tab order
  • LANGUAGE: scripting language
  • onChange: Script to run when the user has changed the textarea
  • onKeyPress: script to run when a key is pressed

<TEXTAREA ...> indicates a form field where the user can enter large amounts of text. In most respects, <TEXTAREA ...> works like an <INPUT ...> field. It can have a name, a default value, script events such as onChange, and is sent to a CGI as a name/value pair. One main difference is that <TEXTAREA ...> is a container tag: it has a start tag ().

In its simplest form, <TEXTAREA ...> requires the NAME, COLS and ROWS attributes, and nothing between <TEXTAREA ...> and </TEXTAREA>.

<FORM ACTION="../cgi-bin/mycgi.pl" METHOD=POST>
your comments:<BR>

gives us this form:

your comments:

The contents between <TEXTAREA ...> and </TEXTAREA> are used as the default value.

<FORM ACTION="../cgi-bin/mycgi.pl">
your response:<BR>
<TEXTAREA NAME="comments" COLS=40 ROWS=6>
John said
: I think it's a great idea
: but it needs more thought

gives us

your response:

The contents are interpreted as text only; HTML markup is ignored. Theoretically the user can type unlimited amounts of text into the textarea field. In reality the browser sets the limit, usually no more than 32 K. If you want users to send in their latest novel, consider using file upload.

About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.