Formcode Request
HTML Form Configuration
To configure a form
to use formhandler:
- Make /cgi-bin/formhandler.pl
the ACTION for your form. The METHOD may be
either GET or POST.
- To use semicolon as a delimeter
Make /cgi-bin/formhandler1.pl the ACTION for your form.
- There must be a field (typically
a hidden field) named formcode whose value is
the code name requested for handling the form. Unless there is
a conflict with an existing code, the code will be assigned as
requested. Note that the code specifies how a form is handled, but
does not have to be unique to each form. This means that all
form results that are mailed to a single address in a single format
could use the same form code. Similarly, a single file could be
set up to receive the output of multiple forms, which might use
a hidden form identifier field to distinguish between forms. Using
a single code for multiple forms allows a user to create forms
that can be active immediately, without having to wait for administrator
intervention.
- An example of the above form configuration lines would be
(variables shown in italics):
<FORM ACTION="/cgi-bin/formhandler.pl"
METHOD=POST>
<INPUT TYPE="hidden" NAME="formcode" VALUE="myformcode">
- Note that any data file that receives data must be writable
to the www user.
- You have the option of specifying a response page for each
form code. This is a page returned to the user after the form
is processed. If no page is specified, a default 'thanks for the
input' page is returned that includes a link to the referring
form.
Output
Examples Form data may be returned
in one of three formats. This list gives examples of each type.
- HTML: Data is returned as
an Unordered List of the field names, with field values saved as
an unordered list item nested beneath the field name. For example:
- fieldname1
- fieldname2
- value2 value2 value2
value2
- fieldname3
- Named Pair: Data is returned
as "fieldname = value", with one pair per line. For example:
fieldname1 = value1
fieldname2 = value2 value2 value2 value2 value2 value2
fieldname3 = value3
- Unformatted: Data
is returned as a list of field values enclosed by double quotes,
separated by commas. The values are returned in the field sort
order. For example:
"value1", "value2 value2 value2
value2 value2 value2", "value3"
Administrator
Configuration
Formcodes (as described
above) are created in /usr/local/etc/httpd/cgi-bin/formhandler.cf
by the owner of the file or a root user. The entry is created between
the %FHConfig = ( and the corresponding );. This
entry is in the form:
"formcode" => "format-style,field_sort_order,
output_method,output_file,email_address, response_link",
where:
- formcode is the assigned/requested
code that identifies the form. This must be unique within the
configuration file.
- format-style
is the format for the returned data. It may be one of the following
values (see examples ):
- html: the field
names are returned formatted as an unordered list (HTML tag <UL>),
with the field values included as an embedded unordered list
below the field name.
- named-pair:
the data is returned as fieldname = fieldvalue, with
one name/value pair per line.
- dump:
only the field values are returned, enclosed in double quotes
and separated by commas. The fields are returned in the order
specified by field_sort_order. For example, the data
may appear as "field value 1","field value 2","field value
3"
- field_sort_order specifies
whether the returned data is to be sorted, and in which direction.
Legal values are:
- forward: field names
are sorted in ascending order.
- reverse:
field names are sorted in descending order.
- none:
fields are unsorted and should appear in the order they occur
in the form.
- output_method specifies
whether data is to be e-mailed to a given address, saved to a given
file, or both. Legal values are:
- mail: data is sent
via email to the address specified in field 5, email_address
- file:
data is appended to the file specified in field 4, output_file
- both:
both the above actions are taken
- batch_mail:
data is saved to a file that is automatically mailed once per
weekday if the filesize is greater than zero. This is handled
by /usr/local/etc/form.deliver
- output_file specifies
the full path name of the file to which data will be appended if outputmethod
is set to file or both. The file must be writable
to the 'www' user.
- email_address
specifies the email address to which data will be sent if output_method
is set to mail or both.
- response_link
specifies a web page that will be returned to the browser after
the form has been processed. If no form is specified, the script
returns a 'thank you' message and a link to the previous page.
Created:
July 22, 1997
Last updated: 8th June 2004 - go
Office of Academic
Computing |