|
Services
> Web Services
> Interactive
Forms > Forms.cgi
Forms.cgi
action="http://www.whoi.edu/cgi-bin/whoi/Forms.cgi"
DESCRIPTION
This CGI script is used
to email web form results to a designated email address as well
as cc: the submitter.
METHODS
- sub check_url:
checks to see if the form calling this CGI script is on a list
of verified servers and if not returns an HTML Error page
- sub get_date:
puts the date and time of the submitted request into a variable
named '$date'
- sub parse_form:
defines an array %Config which holds names and values of specific
Form Fields used to control the design, format, required fields,
etc. This method takes the datastream and parses it.
- sub check_required:
checks the fields you have designated as required
- sub return_html:
returns a confirmation page to the submitter
- sub send_mail:
sends email via the sendmail program to the designated recipient
and the submitter
- sub check_email:
verifies that the email address of the submitter is valid
- sub body_attributes:
checks the %Config array for specific controls that will format
the design of the returned HTML page
- sub error: returns
an HTML page with specific details about the errors committed
in sending the form results. They can be: bad_referer: if form
was not submitted from a validated web server; request_method:
if request method is not either GET or POST; no_recipient: if
no recipient has been designated (this must be designated by the
author of the form as a hidden field.); missing_fields: if form
has required fileds that are blank
The key to this CGI Script
is that it is controlled by the array %Config. As you designate
form fields with set values or user defines values, so %Config controls
how the script works for you. %Config is an array with size 22.
The fields are:
- recipient: email
address the form results are mailed to
- subject: the
subject line of the email being sent to recipient
- email: email
address of the submitter. it is used to cc: the submitter
- realname: name
of the submitter used in email formatting
- redirect: url
to be redirected to after submittal
- receiver: name
of the recipient printed on the confirmation HTML page
- title: header
on top of the returned confirmation HTML page
- bgcolor: background
color on the confirmation HTML page
- background: background
image on the confirmation HTML page
- link_color: link
color on the confirmation page
- vlink_color:
visited link color on the confirmation HTML page
- alink_color:
active link color on the confirmation HTML page
- text_color: text
color on the confirmation HTML page
- sort: list of
form fields in the order you would like them displayed separated
by a comma
- print_config:
print out the list of %Config fields along with the form results
- required: list
of the form fileds you would like to be required separated by
a comma
- return_link_url:
a url used as a footer link on the confirmation HTML page
- return_link_title:
the title of the return_link_url to be displayed at the footer
of the confirmation HTML page
- print_blank_fields:
list of fields to print on the confirmation page even when left
blank
- missing_fields_redirect:
url to redirect submitter when required fields are missing
- form_url: url
of the form being submitted
The realname and email
form fields should be user-input as they are required for the Forms.cgi
to work properly.
(Note: if your form does not need this info, supply a hidden field
with dummy information for these fields). The rest are not required
and can be used as either user-input or hidden fields.
Examples of how to use
the Config form fields in your HTML form.
<input type="hidden"
name="recipient" value="voipadmin@whoi.edu">
<input type="hidden" name="bgcolor" value="#FFFFFF">
<input type="hidden" name="link_color" value="#003366">
<input type="hidden" name="vlink_color" value="#6699cc">
<input type="hidden" name="alink_color" value="#666666">
<input type="hidden" name="return_link_title" value="Voice over
IP - Home">
<input type="hidden" name="required" value="realname, whoi_phone,
email, department>
<input type="hidden" name="subject" value="VoIP Feedback Form">
<input type="hidden" name="title" value="VoIP Feedback Form">
<input type="hidden" name="return_link_url" value="http://www.whoi.edu/CIS/VoIP/overview.html">
<input type="hidden" name="receiver" value="VoIP Administrators">
<input type="hidden" name="form_url" value="http://www.whoi.edu/CIS/VoIP/feedback.html">
<input type="text" name="realname" size="20" maxlength="40">
<input type="text" name="email" size="15" maxlength="40">
|