Lab Exercise 2CMPUT 410 (Fall 2004)
Due Date: Week 4 before the end of your lab time. Javascript can capture events and act upon those events. The event triggered by the submission of a form can be captured by Javascript and the input can be validated before the data is submitted to the server.
Reproduce the HTML code to render the simple HTML form as in Figure 1.
Notice the allignment of the input fields and the frame arround the
form. This form comprises some fields that are optional and others that are
mandatory. Mandatory fields are marked with an asterisk.
All fields are text fields except the
Write the necessary Javascript code that captures the data before it
is sent at form submission time, and validates the input.
If any of the mandatory fields are missing, the code should pop-up a
message indicating that the field needs to be entered. The incorrect
field should get the focus. The form need not be sent to any CGI or servlet. As an action, you could e-mail the data to yourself.
Additional (not part of the exercise):
|
End of Page |