First off - some corrections

Thanks go out to Eugene Gorman, who accused me of "misinforming the public" by saying that only GIFs can be used as document backgrounds. JPEGs can also be used, and will save you some disk quota.

Also, it seems that I may have missed a few (hundred?) colours in my table of hexadecimal RGB triplets last issue. I noticed this while looking at CHEBUCTO CONNECTIONS from a graphical account. Apparently, backgrounds can be any colour at all, but text and links are automatically converted to the closest solid colour. So, get out those base converter applets! Windows has the Windows Calculator, and I'm told that Mac and OS/2 "supercalculators" can be had from somewhere on the Internet. If someone knows the locations of these, please try to upload them to the PDA.

An introduction to Forms

[go search], [go people], and Web search engines like Lycos all use forms to get information from you. So does the "Nerdity Test", whose URL escapes me momentarily. In fact, almost anywhere that you go on the Web, you're almost sure to find some form of form.

Forms use cgi-bin scripts (see September's issue) to do their dirty work. All of those input fields, check boxes, radio buttons, and whatever else are sent, through the use of spells and incantations, to the cgi-bin scripts that "parse", or process, them.

[Actually, it's not really that complicated, or at least that's what I'm told by Those Who Know. Apparently, the WWW server software "posts" the form results as "environment variables" which the cgi script processes. If you're acquainted with DOS or OS/2, environment variables are where such things as the PATH are stored. Type `set' (without the quotes) and press ENTER to see a list of currently stored environment variables.]

In this issue, I'll spout some spells and incantations used to make forms; in the next, we'll worry about how you, as a CCN user, can get something out of them in your Web pages.

The FORM tag

All forms start with the <FORM> tag. This tag generally encloses two arguments, METHOD and ACTION. METHOD should usually be POST, although some ancient forms need the archaic GET method. ACTION is the URL of the CGI script that processes the form results. Note that forms can not be nested. Here's an example of the FORM tag:

<other form tags and HTML go here>

The INPUT tag

The <INPUT> tag is used to get various information from the user. This tag takes a few arguments, most notably TYPE, NAME, and VALUE. TYPE can be "text", "checkbox", "radio", "submit", "reset", or "hidden" (with the quotes). "text" asks the user for text or numeric information; "checkbox" implements an on/off selection; "radio" implements a one-of-many on/off selection; "submit" is the form submit button; "reset" clears the form; and "hidden" is not shown to the user, but is submitted to the CGI script.

NAME is the name of the variable that is passed to the CGI script. VALUE is the value (or default value for a TYPE of "text") that is stored in that variable name. For example, you might be looking for the user's country of residence. You could use a tag like: <input type="text" name="RES" value="Canada">. An example of the INPUT tag:

Text: <input type="text" name="TEXT1" size=50><br>
In my opinion, pickles are interesting <input type="checkbox" name="check1" value="ThisCheckWasChecked" CHECKED><br>
I have a 2400bps modem <input type="radio" name="MODEM" value="2400"><br>
I have a 14.4Kbps modem <input type="radio" name="MODEM" value="14400"><br>
<input type="hidden" name="HIDDEN" value="hidden">
<input type="submit" value="Submit!"> or <input type="reset" value="Clear">

Note the SIZE tag, used to set the size of the text input field, and the CHECKED attribute, used to denote a checkbox or radio button that is checked by default. Radio buttons of the same group must have the same name.


The <TEXTAREA> tag is used to create a (possibly) multiple-line text input area. Unlike the INPUT tag, TEXTAREA is an enclosing tag -- that is, like the anchor (<a>) tag, it has a starting tag, a closing </TEXTAREA>, and possibly something in between. In this case, that something in between is the default text that you want displayed in the text area, before the user inputs anything him/herself.

TEXTAREA in its usual incarnation takes three parameters: NAME, ROWS and COLS. NAME is the variable name (see above), and ROWS and COLS specify the size of the text area. An example of the <TEXTAREA> tag:

Message text:<br>
<textarea name="MESSAGE" rows=3 cols=70>Example text</textarea>

The SELECT and OPTION tags

The <SELECT> and <OPTION> tags are used to present the user with an equivalent to the drop-down list found in today's operating systems (using various different names). These tags are best explained with an example:

My favourite acronym is:<br>
<select name="acronym">
<option>CCN (Chebucto Community Network)
<option>HTML (Hypertext Markup Language)
<option>AMSAP (As Much Sense As Possible)
<option SELECTED>ALSAP (As Little Sense As Possible)

The <SELECT> tag encloses the option list, and each <OPTION> marks a possible selection. When the user clicks on the list (represented by the default selection, which is marked by the <OPTION SELECTED>), the list drops down and s/he can choose a favourite acronym. Of course, the same thing could be done with a group of radio button <INPUT> tags -- the choice is yours. Personally, I prefer the OPTION route, as it creates less screen clutter.

Of course, none of this is any use without a way to get the answers to you. See the next issue for details.


Chebucto Connections TIPS FOR POWER USERS
is edited by Michael Smith
who is happy to receive Questions, Comments or Suggestions.
If your browser does not support mail, write to Michael later at aa529@ccn·cs·dal·ca.

Last Month: November 1995 Next Month: January 1996