Nanyang Technological University

Using Submission Form in NTU

  • What is a submission form?
    A submission form or form submission is a technical term we used to refer to web-based feedback forms. They are usually CGI-based, but to the layman, they simply allow the user of the form to gather feedback, replies, survey answers, etc. from a visitor to the website.
     
    Examples of submission forms used in NTU include the feedback pages you see throughout the NTU pages, like the NTU homepage, and the Centre for IT Services feedback forms. Besides gathering responses from visitors, the interactive element also allows the creator of the form to use it as a simple kind of online application form. The Centre for IT Services' Helpdesk has an online fault reporting form. This is another use for this kind of simple CGI-based forms.
     
    The forms you fill in StaffLink and StudentLink applications are generally NOT the kind of forms we are referring to here. Those are more complex as they have to interact with a backend database. They are developed by professionals with programming skills, and are too complicated for the layman to learn.
     
  • Purpose of this guide
    This guide is meant for those who know how to create a form on a web page. It is not meant to be a step-by-step guide on how to create an online form. That is too technical as forms are one of the more complex features of HTML.
     
    However, if you have a good programming background, or are game enough to read till the end and dissect the source codes of a working form, you are welcomed to continue reading this guide.
     
  • Codes for a form
    These are the codes extracted from the Barebones Guide on Forms.
    FORMS
    Define Form<FORM ACTION="URL" METHOD=GET|POST> </FORM>
    File Upload<FORM ENCTYPE="multipart/form-data"> </FORM>
    Input Field<INPUT TYPE="TEXT | PASSWORD | CHECKBOX | RADIO | IMAGE | HIDDEN | SUBMIT | RESET">
    Field Name<INPUT NAME="***">
    Field Value<INPUT VALUE="***">
    Checked?<INPUT CHECKED>(checkboxes and radio boxes)
    Field Size<INPUT SIZE=?>(in characters)
    Max Length<INPUT MAXLENGTH=?>(in characters)
    Selection List<SELECT></SELECT>
    Name of List<SELECT NAME="***"></SELECT>
    # of Options<SELECT SIZE=?></SELECT>
    Multiple Choice<SELECT MULTIPLE>(can select more than one)
    Option<OPTION>(items that can be selected)
    Default Option<OPTION SELECTED>
    Input Box Size<TEXTAREA ROWS=? COLS=?></TEXTAREA>
    Name of Box<TEXTAREA NAME="***"></TEXTAREA>
    Wrap Text<TEXTAREA WRAP=OFF|VIRTUAL|PHYSICAL> </TEXTAREA>

 

  • More about the email sorter Formmail.pl
    By default if no special program is called when the responses to the form is sent to the mail recipient, the responses will be in one long string. The result is really quite difficult to comprehend.

    There are some programs which help to parse the long strings into intelligible areas, and one such program is called formmail.pl It is written by Matt Wright (mattw@worldwidemart.com). This is the one that is installed in the NTU Web server. It is written in Perl Script. NTU uses a modified formmail.pl version 1.6.

    The codes that are needed to call this program are some text in the Form action field. Use this POST statement below:

    <FORM METHOD="Post" ACTION="http://www3.ntu.edu.sg/cgi-bin/formmail.pl">

    There are also three main hidden fields of interest to this program. These are:
    recipientemail address that will receive the results. It must be a NTU address ending with @ntu.edu.sg
    subjectemail message subject header
    redirectURL of the 'thank you' page which you have created. This is optional. If you do not use a redirect field, the results of what the user keys in will be displayed on screen once he submits the form. The 'thank you' file is just another ordinary HTML file that you have to create yourself.

    The field names must be in lowercase.

    Examples of how you can use the three fields above:
    <INPUT TYPE="hidden" NAME="recipient" VALUE="whoever@ntu.edu.sg">
    <INPUT TYPE="hidden" NAME="subject" VALUE="XYZ Survey Replies">
    <INPUT TYPE="hidden" NAME="redirect" VALUE=http://www3.ntu.edu.sg/directory_name/thankyou.html>

    Place the three statements anywhere after the POST statement, and before the SUBMIT button statement.

    As for the rest of the form, you can use any of the valid field type you want. There is no limit to the length of field name or any particular way the name of the field ought to be named. Formmail will just take anything in the NAME field wholesale. However, do note that the field names are case-sensitive, i.e. Course is treated as a different field from course. See the sample form given in the next section for illustration.

    There are also many other fields with special functions that you can use in your submission form. Read this Formmail Advanced guide for the details.

 

  • Example of a simple form
    A form is a pretty technical piece of work, as you will need to understand what is a textbox, drop-down list, etc. Some examples are shown below.

    But here is an example of a working form for you to look at its codes. However you will have to change the email address for the recipient field to a valid one. You may be able to decipher the syntax and modify it for your own use. Just substitute the REDIRECT field, the RECIPIENT field, and the SUBJECT field for your own.

    Sample form - view the source codes and print it out for your own reference. Pay particular attention to how the POST statement, special fields, and SUBMIT and RESET buttons are coded.

 

  • Do we accept personalised forms on our server?
    Some people find the formmail.pl program to be too generalised and would like to tailor it for their own use, or they may like to put in their own programs on the server.

    But the Centre for IT Services' stance is:
    No, we do not accept any other scripts on our Web server.

    The reasons are:
    • Security: We do not have the manpower or sometimes the know-how to check that all alien programs are safe on our system. We are accountable to all NTU users when the server fails.
    • Maintenance: It is difficult to keep track of who's program it is that is on the server. People will ask to put something up, but they may not tell us when they no longer need the program. We have thousands of users using our server, so even if only one percent of the users have a special program on the server, the tracking work will already be quite substantial.

    Alternatives:
    • Set up your own server if you know how and have the equipment to do so. Some schools have their own servers.
    • You are free to call any other free services from other websites on your web page. E.g. some people use counter programs from overseas servers, or other free guestbook services.

 

  • Is there a form to use for collecting survey results into a database?
    Yes, we have another Perl script that can output the results filled in from online survey forms into a text file. You can then use whatever tools you like, e.g. database tools, or even spreadsheets to collate the results into usable form. The name of the program is called Surveymail.

Share Article