Scripts
University FormMail
General requirements
  • Forms using the formmail script must be located at a URL with a "rwu.edu" address.

  • Use of the script must be arranged with Web Services, otherwise form submission will not work.

  • Browsers must correctly identify referring pages in order for forms to submit.

Step 1: Notify Web Services

Email Web Services and provide your full name, campus phone number (if applicable), email address, email address where you wish to receive the form submission, and the name and URL of the site on which you wish to use the formmail.

Web Services will reply with a confirmation.

Step 2: Create and set the "method=" and "action=" attributes of your form.

The <form> tag must have a method="get" and an action="http://scripts.web.tufts.edu/formmail/formmail.php" attribute. For example:

<form name="myform" method="post" action=/depository/scripts/FormMail.asp>

Note: the "name=" attribute is optional but it is good practice to include it.

Step 3: Add "email" field

Formmail requires that form users enter a valid RWU email address. This is who the form's content email will appear to be from (like webmaster@rwu.edu):

<input type="text" name="email">

Note: you may add other attributes as desired or you may 'hardcode' this yourself:

<input type="hidden" name="email" value=something@rwu.edu>

Step 4: Add "recipient" field

Formmail also requires that you enter your email to receive the forms content in a hidden field. This must be an @rwu.edu email address. Example:

<input type="hidden" name="recipient" value=jsmith@rwu.edu>

Other features

The following are optional features that you can customize to your preference.

Custom redirect

The custom redirect is a page that you create on your site to which form users will be redirected after form submission. Typically this is a page with a "thank you" message of some sort. If not specified, the same page will display upon successful form submission. You should take advantage of this feature. The input should use the following format, a full URL including machine name should be supplied:

<input type="hidden" name="redirect" value="http://someserver.rwu.edu/directory/thanks.html">

Required fields

The script can check for required fields you specify and alert the form user if any of them are not filled in. The alert will be displayed in a separate page, with a very basic design. This is not a substitute for client-side validation in Javascript, which can do much more, but serves as a basic check for empty text, textarea, radio, multiple select and checkbox fields. Please note that the script accepts "0" and one or more empty spaces as text input and will not produce an error in these instances. Also, single select elements always have one default selection so they will always pass this check. Required fields should be specified as comma-separated words that match required input field names exactly, for example:

<input type="text" name="first name" size="25">
<input type="text" name="last name" size="25">
<input type="text" name="age" size="5">
<input type="hidden" name="required" value="first name,last name,age">

Formmail automatically requires the "email" text field to be filled in (unless you have supplied it), so it is not necessary to specify it as a required field.

Email Subject

You or the form user can specify a subject for the email message, which will show up in the "Subject:" header of the submitted message. Follow the appropriate format below based on your preference. Note that in both cases a name="subject" attribute is necessary:

You specify the subject:
<input type="hidden" name="subject" value="Submission from comments form">

Form user specifies a subject:
<input type="text" name="subject">

Notes

When entering form element names containing spaces, these will be encoded into underscores in the received email. For example:

<input type="text" name="email address"> produces:
email_address

 

Copyright 2009, Roger Williams University • One Old Ferry Road, Bristol, RI 02809
1.800.458.7144 • 401-253-1040
Gmail at RWU | myRWU | School of Law | Maps & Directions | Sites Index & Guide | Legal & Site Policies