How to implement JavaScript

Assignment 2
Why are we doing this?
JavaScript is one of the most useful tools available to the web developer. It is
indispensable for creating user interfaces, which minimize the number of mistakes a user
can make and thus making it easier to store and retrieve data. It’s very important for you
to understand when and how to implement JavaScript in your web pages. The lectures
will cover the “when” and this assignment will cover the “how” of implementing
Bootstrap MAY NOT be used for any projects in this course
The Assignment
Overview: Using the user login form you created for a local Bookstore called The Story
Keeper Bookstore (TSKB) you will enhance it so that validates a salesperson’s data and
verifies the salesperson’s name, the salesperson’s password and the salesperson’s ID.
Task Description: Scenario
In order to access TSKB’s site, a salesperson must login with a valid username, user
password, user ID and user phone number. A user’s email address is also required only if
the user wants an email confirmation of any transaction (The user will indicate this by
checking a box signifying the user wants email confirmation). Develop the login script
using JavaScript that first validates and then verifies the user input.
Validation ensure that the salesperson has entered all the required data: username, user
password, user ID, user phone number and user email address (if requested). The user
password should contain a max of 10 characters and have at least 1 uppercase letter, one
special character and one numeric character, the user ID field should contain an 8-digit
number, the user phone number should consist of 10 digits which can be delineated either
by spaces or dashes and the email address must contain an @ followed by a period and an
email domain that consists of 2 to 5 characters. If the input is invalid, an alert should be
issued to the user to correct the particular error in the appropriate box. The alert should be
specific regarding what the error is and how it can be corrected. Alerts must be issued
one at a time (meaning only a single error appears in the alert). No new alert should
be displayed before the previous issue is rectified. After the alert is issued the user
should be brought back to the field that had invalid data entered so it can be reentered.
Verification checks that the salesperson has an account, i.e., that the username, user
password and user ID match the name, password and ID for one of TSKB’s salesperson.
If the input is not verified, alert the user that an account for them cannot be found. The
alert should contain a message indicating the name of salesperson and that they cannot be
found. Once the input is both validated and verified, alert the user with a simple
welcome message that they have entered the system indicating the salesperson’s name
(first and last) and the transaction chosen (Search the Books Seller’s Account,
Customer’s Book Purchase, Customer’s Book Return, Update a Customer’s Book Order,
Cancel a Customer’s Book Order, Search for a Book or Create a New Customer’s
Program Design and Implementation
The design for the HTML interface was developed in Assignment 1. It consisted of the
following fields: salesperson’s name, salesperson’s phone number and salesperson’s
email address, salesperson’s password, salesperson’s ID, a checkbox for indicating an
email confirmation is requested, a drop-down list allowing the salesperson to indicate
what type of transaction they wish to perform, and buttons as input elements.
In this assignment you will need to implement the functionality for email checkbox
which consists of requiring an email address is entered when the checkbox is checked.
The figures below illustrate some of the various concepts discussed for implementation of
this assignment.