We will look at two ways to allow visitors to add their own
comments to your form, <TEXTAREA>,,,</TEXTAREA> and
<SELECT>...</SELECT>.
The <TEXTAREA>...</TEXTAREA> tags let you create
input elements of more or less arbitrary size on a form.
<TEXTAREA> takes three important attributes:
NAME=" " provides
the name that is passed to the server as the identifying portion of the name-value
pair for this element.
ROWS ="number"
specifies the number of lines of text that the text area will contain.
COLS="number"
specifies the number of characters that can fit onto any one row of the text
area. This
value also sets the width of the text area on-screen.
Add the following code to your form:
<br>
<br>
<dt>
3) Please provide your comments about my
page</DT>
<dd>
<textarea
name="Comments" rows="12" cols="55"></textarea>
</DD>
Insert this code right after the:
<input type="radio" name="Visit" value="Yearly">Once per
year
</dd>
Before the:
</dl>
The size of the area you provide for your visitors to write
in is controlled by the ROWS and COLS tags. This example is 55 characters wide and
12 rows high. If you type more than 12 lines of text, the box will start to scroll
to accommodate your guests.
You can also add some pre-determined text in the box by adding it between the <textarea.........>Some text in the box</textarea> tags.
Being <SELECT>ive
The <SELECT>...</SELECT> pair works much like a
list style, except that it builds a selectable list of <OPTION> elements, instead of
the <LI> list items. Within the <SELECT> tag, the following attributes can
occur:
NAME=" " provides
the name that is passed to the server as the identifying portion of the name-value
pair for this element.
SIZE="number"
controls the number of elements that the pick list displays. Even though you can
still define more than this many elements, it keeps the size of the list more manageable
on-screen.
MULTIPLE indicates that
multiple selections from the list are possible, if this flag isn't present in a
<SELECT> statement, you users can select only a single element from the pick list.
Building a <SELECT> field for your form doesn't take
much work.
Add this to your form. You can fill in the last 3
items!
<br>
<br>
<dt>4) What do you think of this Forms
Class?</dt>
<dd>
<select name="What_I_Think"
size="1">
<option selected> Do you really want to know? </option>
<option> It was hard!
<option> Piece of Cake!
<option>I'm lost!
<option> I want more!
<option> I don't really care.
<option>
<option>
<option>
</select>
</dd>
Again, this goes just before the
</dl>
4)What
do you think of this Forms Class?
Wasn't that easy? Now you can add
custom forms to your Web
site any time you need one.
Please test your form to make sure it works correctly. Contact your instructor for the
next part of this wonderful, exciting, class!