Wellesley College CWIS Generic Forms Engine


Warning: This is a technical document!

(Contents may be extremely boring to uninterested parties.)

Please note: This document contains all the information you need to make an existing form work on the Wellesley college web server. To learn how to create an HTML form, see the Dreamweaver documentation.


Types of Forms

There are two types of forms to choose from:

  1. E-mail form
    This type of form takes input from a user, and emails the results to address(es) you specify.

  2. Comma-seperated value form
    This type of form takes input from a user, and appends it to a text file which you can later import into a spreadsheet or database.


1. E-mail form

Here is the implementation design for the e-mail form:

By design, this Perl script will serve most everyone's purpose for e-mailing the contents of any fill-out form.

You need to create two files on the CWIS machine using a login account. If you do not have one, please contact our Webmaster.

Creating a form

  1. Write your HTML document with the fill-out form in it.
  2. Do NOT name any of your fields "email." You are going to have a hidden field named email, and having the duplicate fields will interfere with the form functionality, sometimes without giving you an error message.
  3. Add the following two fields inside the form:

Where filename should be the full pathname of a text file template which resides on the CWIS machine itself (for example, "/www/data/Department/foo/bar.txt") - *not* a URL! Each address is an e-mail address of a recipient. Use spaces to separate addresses if multiple recipients are specified. You may have forms sent to FirstClass conferences, but you must make special arrangements with the Digital Technologies group.

You may also specify a subject for this piece of mail.

To specify a subject:

<!/****A required subject line the user must enter****/>
<INPUT SIZE=32 MAXLENGTH=32 NAME="_SUBJECT">

To make a field required:

<INPUT SIZE=32 MAXLENGTH=32 NAME="_NAME">

To use a different screen other than the default Done! screen:

Creating the text template file

This file should contain a template of how you want the e-mail to look.

  1. Create a text file that looks exactly like the email that you expect to receive from the form.
  2. Where there is data to be filled in, put a %%XX, where XX corresponds to a field NAME from the form you created.
  3. Please note that the values you specify for any NAME="" fields and any %% variables are converted to uppercase! Therefore, NAME="NAME" and NAME="name" are identical, and %%NAME and %%name are identical.

To make a subject line work properly (as mentioned above in Creating a Form):

Click here for a simple yet complete example. I consider this mandatory reading.

Links to examples of actual forms on our CWIS.


2. Comma-seperated value form

Here is the implementation design for the comma-seperated value form:

By design, this Perl script will serve most everyone's purpose for appending the contents of any fill-out form to a comma-seperated text file.

You need to create three files on the CWIS machine using a login account. If you do not have one, please contact our Webmaster.

1. Creating the HTML form

  1. Write your HTML document with the fill-out form in it.
  2. Do NOT name any of your fields "email." You are going to have a hidden field named email, and having the duplicate fields will interfere with the form functionality, sometimes without giving you an error message.
  3. Add the following two fields inside the form:

Where inputfilename should be the filename of the text file template which resides on the CWIS machine itself (for example, "in.txt") - *not* a URL! This file must exist in the same directory as your HTML file!

You may also have a timestamp automatically prepended by including the following line in your form:

<INPUT TYPE="HIDDEN" NAME="AUTOTIMESTAMP" VALUE="YES">

To make a field in your form required:

<INPUT SIZE=32 MAXLENGTH=32 NAME="_NAME">

To use a different screen other than the default Done! screen:

2. Creating the text template file

This file should contain a template of how you want the comma-seperated value file to look. Note that each form submission will cause one line of data to be appended to your output file, so your template input file should only be one line!

  1. Create a text file that containing appropriately placed fields so it looks exactly like the line of data that you expect to be appended.
  2. Where there is data to be filled in, put a %%XX, where XX corresponds to a field NAME from the form you created.
  3. Please note that the values you specify for any NAME="" fields and any %% variables are converted to uppercase! Therefore, NAME="NAME" and NAME="name" are identical, and %%NAME and %%name are identical.

3. Creating a blank output file

Click here for a simple yet complete example. I consider this mandatory reading.

Click here to see it's output (note that you may need to hit the Reload button).