Mount Holyoke College
Directories
Login
Calendar
Campus Map
About | Admission | Academics | Student life | Athletics | Offices | Giving | News & Events
Web-Based Forms
Submission sent via email
Database Forms
Submission sent to database


Home > The Web at MHC > Web-Based Forms > HTML Code for Web Forms

HTML Code for Web Forms

Webmail is invoked as the ACTION for your form in the standard way:
<form method=post action="/cgi/WebMail">.

Webmail requires that you use the POST method. All of the information passed to Webmail is passed as input fields. You have complete discretion as to the method of creating the information: You may submit the information yourself as hidden elements, or you can have the user enter information.

Required Fields
Certain fields are required for Webmail to function properly. If a form is submitted to Webmail without one of these fields, Webmail generates an error message and displays it to the user. No information will be sent to the recipient.

Field Name What it Does
to_nickname This is the nickname of the Webmail recipient(s) who will receive the information from the form. Webmail recipients must be registered with the Webmaster before they can begin receiving messages from Webmail. Nicknames will typically be MHC usernames for single recipients
(i.e., mylon) or a mnemonic for a group (e. g. libref for the library reference desk). To see what the output would look like without sending any email, use the value test.
from_name This is the real name of the person sending the form. Webmail uses this information in the mail header so that the recipient will know who the mail came from. This value is usually entered by the user submitting the form.
from_address This is the email address of the person sending the form. Webmail uses this information in the mail header so that the recipient will be able to reply to the message. This value is usually entered by the user submitting the form.
subject This is the subject of the message. In free-form messages, it's best to let the user enter the subject. However, for many standard forms, you can use a standard subject line and make it a hidden input so the user can't change it.
message This is the body of the message. In free-form messages, it's best to let the user enter the message.
However, for many standard forms, you can use a standard message
(i.e., Please renew the following book that I have checked out:)
and make it hidden so that the user can't change it.

Additional Fields
You can add any additional fields that you like to contain the information in your form. Be sure to assign each item its own name (with the exception of radio buttons, which are grouped under the same name). You can have Webmail print the contents of any or all of these extra fields at the bottom of your message.

The following list consists of other optional fields that you can use to control Webmail's behavior.

Field Name What It Does
field_required Use this field to make some of your own fields required. If the user doesn't fill them in, Webmail will return an error message telling him or her which fields are missing. The value of this field should be a list of field names, each enclosed in {curly braces}. For example, if I have two that I want to make required, called "city"and "state", I could enter
<input type=hidden name "field_required"
value="{city}{state}">
.

By default, the error message that the user sees if a required value is left blank contains the exact name of the field. Depending on how the field was named, this may not provide a very good description for the user. In this case, you can use the format {fieldname=Long Name}. This way, the error message will show the Long Name of the field, which will hopefully give them a better idea which field to fill-in.

For example:
<input type=hidden name "field_required"
value= "{city=The City were you live} {state=Your State}">

field_order Use this field to tell Webmail to list your own fields at the bottom of the message. If you create your own fields and want them to display, you must include a field_order field. The value of the field should be a space-separated list of field names in the order in which you want them to be listed. You may use any valid field name, whether it is a standard field or one of your own.

For example:
<input type=hidden name="field_order"
value="from_name from_address city state">
.

from_info Set the value of this field to anything ("yes" is a good choice) and Webmail will report back to you the Internet address and browser used by the person sending the message.
keep_eols Set the value of this field to anything ("yes" is a good choice) and Webmail will not convert the end-of-line characters that are sent as part of text fields into spaces. This has the advantage that you will see things exactly as the user typed them, particularly in textboxes. It has the disadvantage, however, that your email program may try to impose its own idea of where the line breaks should be, thus defeating the purpose.
assume_MHC Set the value of this field to anything ("yes" is a good choice) and when Webmail receives a from_address without a host name, it will assume that the string @mtholyoke.edu should be tacked onto the end.

This option should only be used for forms that are targeted at the MHC community, since doing this for a non-MHC address would lead to an incorrect email address. In this case, it is far better that the user get the standard error message telling her to correct the address.

verify_MHC_user Set the value of this field to anything ("yes" is a good choice) and Webmail will attempt to confirm that the e-mail address given in from_address belongs to a user at MHC. This is very easy for someone to fake, but is a way to check identities and also for screening for cases when users type in their own email address incorrectly.

This option automatically turns on the from_info option.

no_log Normally, Webmail logs all data users submit, in a location that can only be read by system administrators. Set the value of this field to anything ("yes" is a good choice) and Webmail will log only very minimal information about what happens when the user submits a form.

Use this option at your own risk. If you accidentally delete the email, or if an error occurs when the Web server tries to send it to you, the data submitted by the user will be permanently lost.

return_URI Webmail posts a receipt to the sender that contains a "Return" button. This button normally points to the original form. If you would like the "Return" button to point to something else, use this tag. The value is the URL of the place the button should go.

For example:
<input type=hidden name="return_URI"
value="http://www.mtholyoke.edu">
.

send_MIME Set the value of this field to anything ("yes" is a good choice) and Webmail will send the email message in a two-part MIME format, with the data appearing in the second part. This makes it easier to print just the data on a sheet of paper, without all of the email header information.

To access this "part" by itself within Pine, press "V" to View attachments, then choose part #2.

receipt_page If this field is set to the name of an HTML (or SHTML) file in the same directory as the page containing the form, that page is displayed instead of the default confirmation page. This allows you to create a custom confirmation page.

To include the standard results within the custom confirmation page, place the comment
<!--%%PREVIEW%%--> at the location where you want them to appear.

Note: If your receipt page has any images or links to other pages in it, they must be absolute URLs. This is because at the time your page is being displayed the "working directory" of the URL is that of /cgi/WebMail.cgi.

For instance, if the receipt page was stored in /offices/reg/thankyou.html
and wanted to refer to an image in that same folder, it should use a URL like
/offices/reg/someimage.gif. If this is left as just someimage.gif,
the Web browser will try to load /cgi/someimage.gif, which does not exist.

Copyright © 2008 Mount Holyoke College • 50 College Street • South Hadley, Massachusetts 01075.
To contact the College, call 413-538-2000.
This page maintained by the LITS Web Team. Last modified on February 26, 2008.