|
Frequently Asked QuestionsContents
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. ExamplesThis 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 TemplateFrom: [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 <input type="hidden" name="success" value="http://web.mit.edu/successpage.html" /> Forms and HTML editorsIn 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. UtilitiesThere 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). |
| Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility Ask a technology question or send a comment about this web page. |
||