Share this Page URL

Chapter 12. Need Feedback? Create a Form... > Using Text Areas for Multiline Text - Pg. 134

Need Feedback? Create a Form! <INPUT TYPE=TEXT NAME="URL" VALUE="http://"> 134 · Setting the size of the box.To determine the length of the text box, use the SIZE attribute. (Note that this attribute affects only the size of the box and not the length of the entry; for the latter, see the MAXLENGTH attribute in the following paragraph.) For example, the following tag dis- plays a text box that's 40 characters long: <INPUT TYPE=TEXT NAME="Address" SIZE="40"> · Limiting the length of the text.In a standard text box, the reader can type away until her fingers are numb. If you'd prefer to restrict the length of the entry, use the MAXLENGTH attribute. For example, the following text box is used to enter a person's age and sensibly restricts the length of the entry to three characters: <INPUT TYPE=TEXT NAME="Age" MAXLENGTH="3"> Using Text Areas for Multiline Text If you want to give your readers lots of room to type their hearts out, or if you need multiline entries (such as an address), you're better off using a text area than a text box. A text area is also a rectangle that accepts text input, but text areas can display two or more lines at once. Here's how they work: <TEXTAREA NAME="Field Name" ROWS="Total Rows" COLS="Total Columns" WRAP> </TEXTAREA> Here, Field Name is a unique name for the field, Total Rows specifies the total number of lines displayed, and Total Columns specifies the total number of columns displayed. The optional WRAP attribute tells the browser to wrap the text onto the next line whenever the user's typing hits the right edge of the text area.