Information Technology Services: Web

Constructing a HTML form for the Form to File service


To utilize the Form to File service you must construct a HTML form and the form must reside on your ITS UNIX account and be accessible to the web server.

Please note: Although you may construct your form prior to receiving notification for approval, your form will not function until steps 1-3 have been completed.

Details

The form tag: <FORM... >

In order to allow your HTML form to use the formfile.cgi script you must tell your HTML form where the Form to File program is located and which form it is going to be working with. This is done in your FORM tag's ACTION attribute by specifying the URL to the Form to File cgi program and a form key separated by a question mark '?'. Your form key is sent to you with the email which confirms your form has been registered.

    Composing your FORM tag's ACTION attribute for Form to File:
  1. URL to formfile.cgi: http://www.albany.edu/cgi-bin/formfile.cgi
  2. A name value pair for your form key. The form key is unique for each form utilizing formfile.cgi.
    The name for the value is "2file". This never changes.
    With the key you are given in the email which confirms your forms have been registered, you compose your form key name=value pair.
    For example, if you registered two forms and received the keys mykey1 and mykey2 then your form=value pair for your keys would be 2file=mykey1 and 2file=mykey2.
    Note: these name=value pairs are not interchangeable. You need to use the appropriate key with each of your forms. We will try to provide keys which are synonymous with the name of each form whenever possible.
An example of a form tag utilizing formfile.cgi
<FORM ACTION="http://www.albany.edu/cgi-bin/formfile.cgi?2file=mykey" METHOD="Post">
<!-- Text and controls which make up your form -->
</FORM>

Options:

You have a few options available which may be specified within the code of your HTML form

  1. Mandatory fields. You may specify which fields in your form must be filled in by placing a period "." after the form control's NAME value. E.g. <INPUT TYPE="text" NAME="phone.">
  2. Date, Time, and IP stamp information. To include optional information for each entry of your form you may use a hidden form control with the name "stampinfo" as outlined below.
    1. Date stamp. By default, the Form to File service inserts a date stamp in your data file. I. e. MM/DD/YYYY E.g. 12/20/2001 or 6/7/2001 You may disable the date stamp with the "date_off" value. E.g. <INPUT TYPE="hidden" NAME="stampinfo" VALUE="date_off">
    2. Time stamp. You may, in addition to or instead of the date, include a time stamp. I.e. HH:MM:SS This is a 24 hour time scale: E.g. 16:20:28
      You may turn on the time stamp with the "time_on" value. E.g. <INPUT TYPE="hidden" NAME="stampinfo" VALUE="time_on">
    3. IP stamp. If you need to determine unique submissions of your form, you may include the IP address of the computer which submitted the data. Duplicate IP addresses may indicate repeated entries by the same person. Please note: Duplicate IP addresses in your data file only indicates that data was sent by the same computer but, not necessarily the same person.
      E.g. <INPUT TYPE="hidden" NAME="stampinfo" VALUE="ip_on">
  3. Submission feedback. After users submit data through your form they will be presented with a summary of the values they submitted.
    You can add a back link on this summary page using a INPUT tag of type HIDDEN with the NAME equal to "previous-url".
    E.g. <INPUT TYPE="hidden" NAME="previous-url" VALUE="http://www.albany.edu/website/survey.html">
    If you do not wish to display this default feedback, you may cause the Form to File program to go to a web page of your choosing using a INPUT tag with the NAME "next-url".
    E.g. <INPUT TYPE="hidden" NAME="next-url" VALUE="http://www.albany.edu/website/thankyou.html">

Special considerations:

Due to the way web browsers transmit the values for certain types of form controls, you may need to insert hidden fields within your form as place holders to ensure the number of fields written to your data file does not fluctuate for each submission of form data.

To accommodate usage of these form controls you cannot give separate form controls identical names. For example, if you define two text fields and both ask for a phone number, the text fields' names must be unique. E.g.
<INPUT TYPE="text" NAME="homephone"> and
<INPUT TYPE="text" NAME="workphone">

Form controls requiring hidden fields as place holders
If you wish to use radio buttons or check boxes in your form, you will need to proceed each control's HTML tag with an identically named hidden field in order to hold a place in the data file when no value is entered by the user of your form. Refer to examples below.
  • Radio button groups. If you do not specify a default value for your radio button groups with the "CHECKED" attribute for one of the radio button controls within each radio button group, you will need to proceed the radio button group with a hidden field of the same name.
    A radio button group with a default value selected:
    <INPUT TYPE="radio" NAME="radio_icecream" VALUE="yes" CHECKED>Yes
    <INPUT TYPE="radio" NAME="radio_icecream" VALUE="no">No

    A radio button group with no default value selected:
    <INPUT TYPE="hidden" NAME="radio_icecream" VALUE="">
    <INPUT TYPE="radio" NAME="radio_icecream" VALUE="yes">Yes
    <INPUT TYPE="radio" NAME="radio_icecream" VALUE="no">No
  • Check boxes. To use check boxes you must proceed each check box control with a hidden field of the same name. E.g.
    <INPUT TYPE="hidden" NAME="color_red" VALUE="">
    <INPUT TYPE="checkbox" NAME="color_red" VALUE="red">Red
    <INPUT TYPE="hidden" NAME="color_blue" VALUE="">
    <INPUT TYPE="checkbox" NAME="color_blue" VALUE="blue">Blue

Return to Form to File

Step 4next arrow

University at Albany homepage