Creating a Text Area

The next section of the contest form allows contest participants to write a descriptive of the taste of their ice cream recipe. Because this would take more space then a text box, the text area property allows more space to enter long strings of text. The tag used for this property is the <TEXTAREA> tag. The syntax of the <TEXTAREA> tag is:

<TEXTAREA ROWS=value COLS=value NAME=text>Default text</TEXTAREA>

where the ROWS and COLS properties define the number of rows and columns in the text box, and Default text is the text that appears in the text box when the form opens. Although it is not required, you could use default text to provide additional instructions to the user about what to enter in the text box.

The text you enter into a text box does not automatically wrap to the next row in the box. Instead, a text box acts like an input box in which the text is automatically scrolled to the left as additional text is typed. You can override this default behavior using the WRAP property. There are three values for the WRAP property.

  • OFF: All the text is displayed on a single line.
  • SOFT (or VIRTUAL): Text wraps automatically to the next row when it extends beyond the width of the text box. The CGI script is still sent in a single line.
  • HARD (of PHYSICAL): Text wraps automatically to the next row when it extends beyond the width of the text box. When the text is sent to the CGI script, the line-wrapping information is included.

Return to your text editor and the contestform.html file. Directly above the </TABLE> tag, insert the following lines:

<TR>

<TD VALIGN=TOP>Description of Ice Cream:</TD>

<TD>

<TEXTAREA ROWS=3 COLS=50 NAME=Description WRAP=VIRTUAL></TEXTAREA>

</TD>

</TR>

Save your changes and view it in you Web browser. Notice that the form is again stretched out. Return to the line that reads Description of Ice Cream and place a page break <BR> between words of and Ice. Resave your file and reload it in your Web browser. The form should have returned to its original state.