COP3832, Assignment 5
Due Wednesday 12/5 at the start of class.
Upload the script and hand in a printout.
There will be several different HTML pages displayed by this script
-
The Login Page. If there is a cookie for this page that contains the
ID Number, then skip the Login Page and go directly to the
Form Page, using the ID Number from the cookie to fill in the
data on the Form Page. If there is no cookie, then display the Login
Page.
-
The Form Page. If the user's ID Number is in the database,
then fill in the form elements with the data from the database.
-
The Confirmation Page.
The Login Page will display a form with a Submit button , a
text box for the ID Number, a checkbox for saving a cookie, and
a checkbox for deleting a cookie. When the button is clicked:
-
Validate that the ID Number is 2 to 6 letters followed by
2 digits; or 2 to 5 letters followed by 3 digits.
-
If the ID Number is invalid, then redisplay the Login Page
with an appropriate error message.
-
If the ID Number is valid, then display the Form Page
as follows
-
If the ID Number is already in the database, then fill in the
Form Page with the user's data.
-
If the ID Number is not in the database, then display an empty
Form Page.
-
Have a checkbox on the page with the label: Save ID in cookie. If
checked, then the ID Number will be stored in a cookie when the user
submits the page. The cookie should expire in one minute and should only
be readable by this script.
-
Have a checkbox on the page with the label: Remove cookie. If checked,
then the cookie containing the ID Number should be deleted when the
page is submitted.
The Form Page will have the following.
-
Display the ID Number on the page as plain text (do not display
it in a form element.)
-
Use the form that you created in Homework 3.
-
A Submit button. When this information is submitted, the script should
verify that each field has been filled in or selected, and that it meets
the requirements from Homework 3.
-
If there are invalid fields, then redisplay the Form Page with appropriate
error messages, and use the background color of a <td> field to highlight
all of the invalid fields. Be sure that the user's previous choices are still
visible.
-
If all the fields are valid, then display the Confirmation Page.
The Confirmation Page will have the following:
-
Display the user's information as plain text (do not display them in form
elements.)
-
Display the following buttons in a form:
-
Edit: if clicked, then the Form Page is redisplayed, with all
of the user's information filled into the form.
-
Confirm: if clicked, then write the user's information to a
database. Use the ID Number as the key field. Redisplay the
Confirmation Page with with an extra message indicating that the data
has been entered into the database.
-
New User: if clicked, then display an empty Login Page.
Please note that the data is not entered into the database until the
user presses Confirm on the Confirmation Page.