Table of Contents

Coursework 1: Client-Side Programming

Formally issued on: Tuesday 21st February, 2012.

Lecturer: Dr Chris P. Jobling.

Due date: Session on Thursday 15th March, 2012.

The Exercise

<html><!– 2007: Develop, test and validate an HTML5 document that collects the following information from the user: last name, first name, middle initial, age (restricted to be greater than 16), and height in cm (restricted to the range 90cm to 250cm). You must have event handlers for the form elements that collect this information that check the input data for correctness. Messages in alert windows must be produced when errors are detected and the offending controls should gain focus. –></html>

<html><!– 2008-2011: Develop, test and validate an HTML5 document that acts as a registration form for a web application. The registration form should request a user name, contact email address, and a password.

You must have event handlers for the form elements that collect this information that check the input data for correctness.

  1. Messages must be produced when any errors are detected and the offending control should gain focus: alert boxes can be used for this purpose although extra credit will be given if DHTML is used to ensure that the messages appear in the document itself.
  2. The error messages should be clear in reporting the corrective action to be taken by the user.
  3. Validation checks on individual form fields should be triggered by loss of focus.
  4. The submit button should be labelled “Register” and it should:
  5. The reset button should be labelled “Cancel” and should return the form to its initial state. –></html>

Your company wants an efficient way of processing employee expense claims. It has decided to use create a web app on its Intranet for this purpose. You are to create an expenses submission form with the following features:

You should think about the names that you will be passing to the server-side of the web app in the choice of your field names.

Where possible, all error messages should display in the form and be highlighted by colour changes and change of focus.

Hint: Start by creating the form in HTML5 and then write the JavaScript to make it work. Use the new HTML5 input types and form validation attributes where supported.

Submission Details

You should develop your solution in a single HTML5 file and submit a paper copy to me at the start of the contact hour session along with a copy of the attached submission cover sheet; this will be returned to you with feedback. You should also submit me an electronic copy of the HTML5 file and any external CSS and JavaScript library files that you have used, packaged in a single zip file using the Assignment Tool on Blackboard. I will use this version for testing.

A maximum of 5 marks will be awarded if I am not provided with the electronic version for testing.

How this Work will be Assessed

JavaScript must be used for the expenses calculation but you can and should use the new HTML5 form elements and validation attributes where appropriate. For extra credit you will provide JavaScript alternatives to these if the browser doesn't support them. Hint: use the modernzr library to check for the availability of the required attributes and elements.

You may assume that JavaScript will be turned on … but should provide a warning message to the user if it isn't!

There will be:

Late submissions will not be marked.