Skip to content Accesskey=4Skip to sub-navigation Accesskey=NView our Accessibility Options MIT Information Services and Technology Home About IS&T Contact IS&T Site Map Search Advanced Search
Getting StartedGetting Services by Topic or Alphabetically Getting Help

Web Publishing Reference
 

Web Reference home

MIT Guidelines

Creating Web Pages

 

Web design process
Information Design
Code Standards
Meta tags
Forms
Graphics and Color
Printing
Testing
Software
FAQ

Using MIT Web Space

web.mit.edu Resources

MIT/IS&T Resources

Training

Search the Web Reference:

 

Frequently Asked Questions

Contents


How do forms work on web.mit.edu?

The cgi script that web.mit.edu uses to process email forms requires two documents, an HTML file and a text file. The HTML file contains what the form will actually look like. It must have a <form> tag with the following syntax:

<form method="post"
  action="http://web.mit.edu/bin/cgiemail/afs/athena.mit.edu/org/i/ist/comments.txt">

Where <action> must contain http://web.mit.edu/bin/cgiemail plus the full path of your text file. It must also have a submit button, and optionally a reset button:

<input type="submit" value="send email" />
<input type="reset" value="reset this form" /> 

The text file is a template for how the email will look. It will have bracketed variables, such as [email], that correspond to the email address submitted through the form. See below for full examples of both these documents.

For general information on form tags see the W3C's XHTML 1.0 Specification.


Examples

This is an example generated using the mkcmtform script.

HTML Document

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Comment Form for comment@mit.edu</title>
  </head>
 
  <body>
  <h1>
  <img alt="MIT" src="http://mit.edu/img/mit-daily-logo.gif" />
  Comment Form for comment@mit.edu</h1>
 
  <hr />
 
  <!-- NOTE: the ACTION below must be changed if comments.txt 
      is ever moved from the directory it is now in:
      /afs/athena.mit.edu/org/c/cwis/ -->
  <form method="post"          
    action="http://web.mit.edu/bin/cgiemail/afs/athena.mit.edu/org/c/cwis/comments.txt">
 
    From: (your email address please)<br />
    <input name="email" size="30" /><br />
    Subject: (please don't leave blank)<br />
    <input name="required-subject" size="60" /><br />
    Message:<br />
    <textarea name="required-body" rows="10" cols="60"></textarea>
    <p>
    You may <input type="submit" value="send email" /> when done, or
    <input type="reset" value="reset this form" /> if you want to start over.
    </p>  
  </form>
  </body>
 
</html>
        

Text Template

From: [email]
To: comment@mit.edu
Subject: [required-subject]
Errors-To: web-request@MIT.EDU
 
[required-body]
----
NOTE: This message was sent using a WWW form. The address [email]
was typed manually, and may easily be incorrect.

Tip: add a cc: [email] in the text file (on its own line between From: and To:) to send a copy of the message to the sender


Adding a success page


To show a web page (such as a thank you page) once a person has submitted a web form, put in a "success" line that refers to the URL you want the users to see after submitting the page. Make sure the value is a full url (including http://).

<input type="hidden" name="success" value="http://web.mit.edu/successpage.html" /> 

Forms and HTML editors

In order to use web authoring software such as Dreamweaver, you need to generate the HTML document as instructed in Dreamweaver documentation and then create a text file that resembles the example above manually with a text editor. You may also have to manually change the <form> tag to make sure it has the right syntax. You can also use the translateform script.


Utilities

There are two utility scripts that are available on web.mit.edu to make processing forms easier. Translateform extracts form tags and puts them into a template for cgiemail and process-comments converts specially formatted text into tab-delimited records (often used to format text to be included in a spreadsheet or database).

MIT Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility
Ask a technology question or send a comment about this web page.

Mit Counter