Homework 2
CS320, Spring 2004
Due: Monday, April 12
Please upload your html files to your home directory on the server
cs.calstatela.edu (more details about the server and how to upload your
work can be found here), and send
the URL
to your start.html files,
presumably http://cs.calstatela.edu:8280/username/start.html,
to csun@calstatela.edu. Make
sure
to use CS320
Spring 04 HW2 as the subject of the email, and include in the
email
your name so I don't have to guess names from
email addresses.
1. [Dynamic Content] (20pt) Modify the start.html you created in Homework
1 as follows:
- For the first form:
- Add another drop-down list (or simple/scroll list, whichever
looks best with your page layout) to the first form. The drop-down list is initially
empty, and when a user select one category from the list of the product
categories, display the attributes of the selected category in this
list.
- Specify the METHOD attributes of both forms to GET.
- Specify the ACTION attributes of both forms to the url of a verify.html, which you
will create in the second part of this
assignment.
- For the second form:
- Add an radio button which labeled as "New User"
2. [Form Validation] (30pt) Create a verify.html
file which processes
the user input from start.html.
If the user input is not
valid, pop up an error message which clearly
explains which input field(s) is
wrong and why, then return to start.html.
If the user input is valid, display the information submitted, for
example
Browse
Category: CPU
Attribute: Frequency
or
Search
Category: CPU
Attribute: Brand
Search string: Intel
For the first form, the user input is not valid if:
- no category / attribute specified, or
- neither Search nor Browse is specified, or
- for Search, no search string specified, or
- for ProductID search, the search string is not in the format of
"XXX-nnnnnn", where XXX are three letters, and nnnnnn is a 6 digit
number, or
- the user input does not meet any addtional contraints you may
impose depending on your choice
of categories/attributes.
For the second form, the user input is invalid if the "New User" radio button is
selected, and
- the length of the user name is less than 4, or
- the user name contains any character other than letters and
digits, or
- the length of the password is less than 6, or
- the password contains
only letters and digits, or
- the password contains white spaces.