print $cgi->textfield(There are several attributes that are unique to the text area. The first is the -rows attribute, which (unsurprisingly) is used to set the number of rows you want the field to display. -cols will set the number of visual columns, which in practice is similar to the -size attribute on the text field. These are purely visual settings and do not change the allowed length of any data entered in the field itself. The -default setting can be used to set a value for the content of the text area.
-name => 'blog_entry',
-id => 'blog_entry',
-default => 'Write something here.',
-rows => 5,
-cols => 55 );
Here is what the above example produces in plain HTML:
<textarea name="blog_entry" rows="5" cols="55" id="blog_entry">Write something here.</textarea>A couple of other attributes you might find useful are -disabled and -readonly. Disabling a text area means that the field will refuse focus or changes - typically it will be greyed out - and will be skipped in the tab index. Marking a text area as read only means that the field can still be selected, but the contents will not be editable.
Here's a sample using the disabled attribute:
print $cgi->textfield(And an example with read only set:
-name => 'blog_entry',
-id => 'blog_entry',
-default => 'Write something here.',
-disabled => 'disabled',
-rows => 5,
-cols => 55 );
print $cgi->textfield(
-name => 'blog_entry',
-id => 'blog_entry',
-default => 'Write something here.',
-readonly => 'readonly',
-rows => 5,
-cols => 55 );
