COP3832, Assignment 5
Due Tuesday 11/9 at the start of class
You are to write two scripts for me. Add links to your server page to each
script. Hand in a printout of each script.
You will need to use the split and join functions.
Handing in the assignment: upload the two separate scripts to the web and
hand in a printout of each.
Script 1
Write a script that will display a form containing the following
-
A text box
-
A textarea
-
A group of three radio buttons
-
A group of four check boxes
-
A hidden field
-
A selection list of several options, only one option may be selected
-
A selection list of serveral options, many of the options may be selected.
-
A submit button
-
A reset button
When the form is submitted:
-
Display all the user's choices in a readable text format. Do not display
the data using form elements.
-
Create a form with two buttons:
-
Confirm. When pressed, display a thankyou page.
-
Edit. Redisplay the original form with the user's data.
Script 2
Allow the user to enter the following. The user must fill in all fields.
-
Name. Be sure that the name contains only letters.
-
Student number. It must be in the format 999-99-9999 or 999999999. All other
formats are invalid. A 9 represents any digit.
-
An e-mail address.
-
An e-mail address has text followed by the @ sign followed by more text.
-
The text before and after the @ sign can contain: letters, digits, underscore,
hyphen and period.
-
A phone number. The allowable formats are
-
(999)999-9999
-
999-999-9999
-
999.999.9999
-
Hobbies as a selection list with multiple choices. At least one hobby must
be selected by the user.
The first time this form is displayed, it should show a form where the user
can fill in the above information.
When this information is submitted, the script should verify that each field
has been filled in or selected, and that it meets the above requirements.
If not, redisplay the page with appropriate error messages, and use the
background color of a <td> field to highlight the invalid fields. Be
sure that the user's previous choices are still visible.
If all the information is correct, display the user's information as text.
Reformat the data as follows
-
Name: first letters of each name in the name should be upper case, all others
should be lower case. Use uc, lc, and ucfirst. (Hnit: split on ' ').
-
Student Number: 999-99-9999. If number was entered without hypens, then insert
them.
-
Phone Number: (999)999-9999. If number was entered in a different format,
then force it to this format.
-
Hobbies: List all selected hobbies.