CECS 5100

Survey of Educational Computer Languages

Fall 2002


Assignment #2 - Forms and Data Validation

Due Date: September 26, 2002

Value: 10 points

Send the instructor an e-mail containing the HTML/JavaScript to complete the assignment. greg@tapr.org. Please indicate the browser you used for testing.

Using JavaScript within HTML write an html/script that implements the following.

  1. Upon viewing the HTML page:
    1. Display the current Time
    2. Display the fields and Information shown in the example below (HTML is supplied)
  2. The user will then fill out the areas of the form
  3. As the user fills in each field, check to make sure the data is valid (see Test Data section)
  4. If the data is not valid, then tell the user that there is an error in the data and then make the field empty.
  5. When the user selects the pulldown for level education, take the selection and place the results in the field next to it (this is a value assign to that field)
  6. When the user presses the submit button to submit their information
    1. if any of the fields are blank, then display a message that says the user has not entered all information and that asks them to please check their entries again.
    2. if all information is complete, then write out the information that the user submitted.

Test Data:

  1. First and Last Name can only contains LETTERS (A-Z, a-z)
  2. SSN can only contain NUMBERS and dashes (0-9, -). You do not have to check for formatting (i.e. the sequence where the dashes go, just for NUMBERS and Dashes.
  3. Phone number only contain NUMBERS, dashes, spaces, and parentheses (0-9 plus dashes, '(', ')', and ' '). You do not have to check for formatting, just the specific 0-9, (, ), -, SPACES.
  1. text and form layout and information as shown
  2. error messages on invalid data entry and when the user submits
  3. output of the information entered by the user in the form
Expected Code:
  1. Student can use whatever JavaScript code they wish to complete the assignment.
  1. I have given you a few examples in this code for the assignment
  2. ***REMEMBER*** to do small segments of code. There are lots of small blocks of code in this assignment that will be used either again or copied/pasted to create new segments with slight changes to variables. If you try to attempt the entire program without taking it in small steps, it will seem huge and impossible to complete.

Display the Time here

Welcome to CECS 5100 Student Information Data Collection

Please take a moment to enter the following fields.
When you have completed the form, press the SUBMIT button to continue.
First Name:
Last Name:
Phone Number:
(940) 565-2000
Level of Education