|
The Text Field Text fields are the form's answer to open-ended questions. They let the users enter information in their own words, and they come in two varieties, geared toward short and long answers. The basic text field - all too familiar to the search-engine crowd - provides a single line for user input. The simplicity of the appearance is matched by the HTML. Just follow the <FORM> tag with <INPUT TYPE="text"> and close it off with </FORM>. You might want to include the optional size=x attribute, which lets you determine the length (in characters) of the space provided; otherwise the browser will use its default settings - which are, as a rule, the most unreadable and annoying dimensions possible. The HTML for one of these mini text-areas might look like this: <FORM> And would appear on the page like this: If you want, you can make "dummy" text appear inside the text area by adding the attribute VALUE="sickening" (but replacing sickening with the text you want to appear). Here's how it looks in HTML: <FORM> And here's how it will appear: But let's face it, the Web is full of windbags, and a tiny crevice on the page doesn't always cut it.... To create a larger text area, you'll need to do something a little different. After the <FORM> tag, insert a tag that looks like this: <TEXTAREA COLS="x" ROWS="y">. As always, you should finish what you start - be sure to add </TEXTAREA> and </FORM> tags. The COLS attribute controls the width of the TEXTAREA. The name's a little deceptive, though; it refers to the number of characters (not columns, per se) that appear at any given time. In turn, the ROWS attribute controls the height of the text area, as measured in the number of lines appearing before you have to scroll. The HTML for a text area might look something like this: <FORM> And here's how it will appear: Not to pile on too much at once, but you might want to include the wrap attribute as well ... it allows the text to wrap inside the text area, so users don't have to scroll off to the right or hit Return as they write away. There are three possible wrap options: WRAP="physical" wraps the text in the input field and sends it to the server just as it appears on screen. Unless you're actually adding a CGI script, it doesn't matter whether you use this or WRAP="virtual" . WRAP="virtual" creates the appearance of wrapped text, but sends the input to the server as if it were one long line. WRAP="off" is the same as not having the wrap attribute there at all.... I'm not really sure why you'd bother with it. |