CS110Introductionsyllabus assignments documentationproject

Forms and Validation

Assignment 8

The purpose of this assignment is to create an online form or questionnaire that provides feedback to you from a viewer of your CS110 Project website. The feedback from the form will be emailed to your own email address.

The goal, of course, is to experiment with different ways of getting information from the user: typed input, radio buttons, menus, and so forth. You may decide to use a version of this form for your project testing — it could be a handy way for your testers to communicate their impressions of the site back to you.

However, this is an individual assignment, therefore each student is required to work on it independently of her project partner!

Helpful materials include:

Specific Tasks

Task 1: Create the questionnaire

Create a folder hw8 in your public_html/protected/ folder. Inside hw8, create a file named assign8.html. This file will contain your questionnaire. Upon submission, the user's input should be sent to your own email account, using the eform.cgi script on puma.

On the top of the page, please include a sentence to let us know how long it took you to complete this assignment, using the following format:

I took *** 3 hours *** to complete this assignment

(the asterisks are important, because we use those to search for the information). You can be honest! We only use this information to make sure the assignment is a reasonable amount of work.

Your questionnaire can contain any type of inputs that you find useful for your project website's evaluation.

Here are the specific requirements:

  1. As usual, a comment at the top of your file with your name and date, and the assignment title.
  2. One form input must ask the user's name.
  3. Your questionnaire must contain at least three different kinds of inputs (not just three different inputs). You can use those you learned in class, or others that you have seen on web pages or read about in HTML references.
  4. The user's name and two of the other inputs must be required (meaning the person filling out the form must enter the information). Mark these in your form with an asterisk. All three required inputs must be of different types.
  5. Your form must contain submit and reset buttons (you may choose the text that appears on the actual buttons).
  6. Finally, you must arrange for the form data to be emailed to your email address.

Optional:

  • You can format the e-mail message using a template file (see lecture notes for details. ) However, formatting the email message is not required for this homework.

Upload the form on the server, and test to make sure everything works properly so far.

Task 2: Validate the form

In this part of the assignment, you will write a Javascript function to validate the form.

Your validating function should check that the three required inputs (marked with asterisks) in your form are filled out. Reminder: these should be three different types of input, so the validation will be done differently for each one.

  • If the form does not pass the validating check, the user should be presented with an alert message asking them to provide the missing information.
  • If the form passes the validating tests, an alert box will be brought up that addresses the user by name and thanks them for properly filling in the form.

Of course, the validating function should be called upon submission of the form, to perform its task.

Make sure to test your code, and that your code is clear and easy to read.

Back to the top of the page


Introduction | Syllabus | Assignments | Documentation | Project

Computer Science 110
Date Created: November 2002
Last Modified: April 2008