This introduction to Reader Response Forms has the following sections -
A capability is available for web page programmers on the BCN site to set up a reader response or registration form, where the reader can be asked to fill in various fields such as to request more information or to register for some event. The reader then submits the form via a "Send" button which results in an email message being sent to some specified email address.
A common nomenclature for this capability is "cgi interface." Which is unfortunate because cgi (Common Gateway Interface) is only a means to accomplish this goal and is also used for many other purposes. Consequently, the term "Reader Response Forms" will be used for this capability, instead of "cgi."
The program being supported for this capability is called e-merge. It has been used widely for this capability on many Internet Service Providers.
The <form> html sequence is used to present a request to the reader to enter the required information. The following is a detailed example of the section of code to be put into your html file -
The above example uses the <pre> tag to show how to line up the field name and input box specifications with as little distracting html as possible. An alternative way to code this sequence is to embed the field name and input box details within a <table> sequence, as follows -
To explain each area in detail -
The <form> line specifies the e-merge program that called to process the form plus the location of a parallel email/merge specification file. It is recommended, but not necessary, that this email specification file be put in the same directory as your html files that use it.
For this example, the "action" field through "/cgi-bin/emerge/" specifies the e-merge program and must be specified as given. The rest of the field, beginning with "xyz/response.txt" specifies the directory structure and your file name for the supporting email specification file, in this case "response.txt" which is in the directory "xyz."
For another example, if your full url address is bcn.boulder.co.us/smith/, and your email specification file is jones.txt, the form line would be the following -
In general, this directory specification for the email specification file, sometimes called the "virtual path," begins with whatever directory structure follows the bcn web address, in this case, "bcn.boulder.co.us."
The <input> line name="required-subject" and type="hidden" specification is fixed and must be specified as given above. The value="Reader Response Demo." is an arbitrary title you supply that specifies the title for the form that will be displayed to the reader and is also included in the subsequent email message. Change it to identify the email from your particular form.
The following lines specify the various fields to request information from the viewer, the internal field names to be assigned to each, and the specifications for the data entry boxes that will be displayed to the user.
An optional "required-" phrase can precede each field name. This forces the reader's browser to require non-blank data to be entered into every "required-" field before the form can be sumitted. In the above example, all the following fields must have text entered into them: fname, lname, comp, street, city, state, pcode, and tel, before the form can be sent.
The <TEXTAREA name="comments" ROWS="5" COLS="72"> line specifies a several line data entry box where the reader can enter unstructured data which will be assigned to the field name of "comments."
The following <input type> lines specify "Send" and "Erase" user action buttons. The actual text in the "Send" and "Erase" fields is your choice to identify the action to the viewer.
See most textbooks on HTML coding for the small print on using these tags.
A separate supporting file (in flat ascii or "txt" format) must be created to specify how to format the resulting email message and where to send it. The format of this file, named "response.txt" in the above <form> example, is as follows -
This file, again - in flat ascii or "txt" format - resides in the same directory as the html file that uses it. Optionally, several html pages may all use this same email specification file, with a different "required-subject" heading for each.
To explain the above fields in detail -
First, the field names from the <form> sequence are specified in the email specification file by enclosing them in square brackets. These fields must be specified with exactly the same spelling as was used in the <form> sequence. For the above example, [required-lname] will be the last name collected by the "Last Name" line in the <form> statement.
The To: a_valid_email_address line specifies where the resulting email message will be sent. This line must be present and must specify a valid Internet address.
The From: [email] line is an optional line to document the email address of the reader sending the form. Note that this works only if the <form> requests an email address. Also note that there is no validity checking on the email address to ensure the user entered a real and valid Internet address.
The Subject: [required-subject] line echoes the value from the <input ... value="Reader Response Demo."> line to allow you to identify what <form> sequence, or what web page, generated the email. In the above example, "Reader Response Demo" will be sent.
The Errors-To: line must be present and must specify another valid email address. If the To: address fails for any reason, the message will be sent to this address. This address should be different from the To: address, and preferably, on a different isp in case of server difficulties. (And, of course, not to some address that is already overloaded with email traffic.)
The following lines specify system values that may be of use to a system administrator in tracing unusual messages and should be included.
The remaining lines define your identifiers and the contents of the fields from the form in the email message. Note that in this case, fname, lname, comp, street, city, state, pcode, and tel are all required fields and the user must have entered some non-blank data before the form was sent.
For a real-world example of a Reader Response Form coding, the following form is used in the Y2K site to allow user feedback.
Note that if you go to that page via the above link, return here with the Browser Back Arrow.
The e-merge program is from http://www.usfca.edu/usf/turner/e-merge/e-merge.html.
Last Update: Wednesday December 28, 2005 , by E. Stiltner
BCN Home Feedback About BCN Donate Search BCN Volunteer!