A10-Regular Expressions

On This Page


Overview

There are two parts to this assignment:

  1. Problem-solving assignment

    Complete the problem-solving assignment following the specification listed below. Extra credit is optional.

  2. Tutorial exercises

    Complete the tutorial exercises following the specification listed below.

Problem-Solving Specifications

For this project, you will update your single page form from the last assignment to validate form data using regular expressions. The updates are shown in emphasis font.

  1. Name your page the same name as before: checkout.html.
  2. For this assignment, submit the form to receipt.html.
  3. Remember that your form must collect the following information:
    1. Buyer's first and last name
    2. Street address
    3. City
    4. State
    5. Zip code
    6. Telephone number
    7. Credit card type (use those shown in the tutorial case)
    8. Credit card number
    9. Credit card expiration with month and year fields
  4. In addition, the form must show a subtotal for the order in the amount of $50.00. Assume that the buyer already selected products worth $50.00 on a previous page and the subtotal was carried forward to this page.
  5. Also, allow the user to select one of the following shipping options:
    1. USPS ($6.75)
    2. UPS ($8.50)
    3. Federal Express ($10.00)
  6. Once the user selects the shipping method, add a 5% tax to the combined amount for the subtotal and shipping and display the shipping, tax and total to the user.
  7. Add a submit button and validate the following before allowing the form to submit:
    1. Buyer's first and last name have been entered and are 50 characters or less
    2. Street address is 6 characters or more
    3. City is 2 characters or more
    4. State is exactly 2 letters (not just characters)
    5. ZIP code is 0, 5 or 9 (5-4) digits (no letters or non-digit characters allowed)
    6. Credit card is between 13 and 16 digits long (including 13 and 16) with blank spaces removed and validated using the Luhn formula
    7. Credit card expiration is a valid date not more than 10 years in the future
    8. Shipping method is selected

    Note you do not need to use JavaScript for validation if your HTML form ensures a correct value. For example, using a selection list for the state would preclude the need to validate the state, assuming that all the selection list option values are exactly two characters. However, your selection list must allow all valid entries (see state abbreviations).

  8. You must use regular expressions in the validation process for the ZIP code and credit card number.
  9. In addition to validating the form, send the form information to a page named receipt.html and display at least the following data from the form:
    1. Buyer's first and last name
    2. Total order amount (including tax and shipping)
  10. Write between three and seven functions to validate your form and call each of the functions at least one time. Place at least one function in a file named checkout.js.
  11. Once you complete this page, test your JavaScript to ensure it works without error.
  12. Complete a README.txt file following the instructions for homework.
  13. Zip your files and submit the zipped archive file to WebCT as explained in the section of this document: What to Turn In.

Hints

  • To verify your credit card validation, you can use the test numbers found here

Tutorial Specifications

  1. Scan the textbook chapter Tutorial 9 to get an overview of the material.
  2. Complete the in-chapter tutorial case exercises (step-by-step instructions to complete the tutorial case study) that are listed thoughout chapter Tutorial 9.
  3. Follow the steps exactly and read the textbook as you progress through the tutorial to enhance your understanding.

    You do NOT need to complete the Review Assignment nor any Case Problems at the end of Tutorial 9.

  4. Zip your files and submit the zipped archive file to Blackboard as explained in the section of this document: What to Turn In.

Tutorial Notes

  • You will get JavaScript errors at some point until you complete the tutorial.
  • Do not be concerned if you see CSS errors. I only grade on the JavaScript part of the tutorial.

Extra Credit

This extra credit is worth 2 points.

  1. Complete Case Problem 2 of Tutorial 7 that starts on page JVS 406 of your textbook.
  2. Include the extra credit solution in your assignment zip file.

Make certain that your README.txt file lists any extra credit attempted.

Grading Criteria

The instructor will evaluate your assignment using the following criteria. Each criteria represents a specific achievement of your assignment and has a scoring guide. The scoring guide explains the possible scores you can receive.

Some scoring guides have a list of indicators. These indicators are a sign of meeting, or a symptom of not meeting, the specific criterion. Note that a single indicator may not always be reliable or appropriate in a given context. However, as a group, they show the condition of meeting the criterion.

For information on grading policies, including interpretation of scores, see the course information page.

Form and Form Validation

  • 10: Demonstrates mastery of the form and form validation techniques
    • Has extra features or demonstrates techniques beyond the assignment
    • Applies concepts from the lessons appropriately
    • Meets all specifications (see above) with particularly elegant solutions
    • Runs with no error conditions reported by the browser
    • Generates correct output given correct input
    • Validates the form and verifies all the specified conditions
    • Behaves in a reasonable way in response to incorrect data
    • Validation functions are clearly defined and reusable
  • 8: Has all the functionality expected of the assignment
    • Demonstrates many techniques from the lesson
    • Meets all specifications (see above)
    • Runs with no error conditions reported by the browser
    • Generates correct output given correct input
    • Validates the form and verifies all the specified conditions
    • May have one minor error in the form or validation
    • Implementation seems more complicated than necessary.
  • 6: Has most of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets all but one of the specifications (see above)
    • Runs with no error conditions reported by the browser
    • Validates the form and verifies all the specified conditions
    • Implementation seems excessively complicated.
    • May have 2-3 minor errors in the form or validation
  • 4: Has some of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets at least 1/2 of the specifications (see above)
    • Implementation seems excessively complicated.
    • May have JavaScript warnings or errors in the browser
    • Missing support files
  • 2: Serious functional problems but shows some effort and understanding
    • Meets less than 1/2 of the of the specifications (see above)
    • Has a major error (detected by the browser) or many minor errors
    • Implementation seems very convoluted
    • Demonstrates few techniques from the lesson
  • 0: Does not execute or not turned in

REAME.txt File

  • 2: README.txt file submitted with specified information included
  • 1: README.txt submitted but some information was not included
  • 0: No README.txt submitted

Extra Credit Case Study

  • 2: Shows complete mastery of the problem.
  • 1: Shows some understanding of the problem.
  • 0: Not submitted, no substantial work, or has major problems

Tutorial Exercises

  • 8: Demonstrates mastery of the assignment
    • Applies concepts from the lessons appropriately
    • Follows the steps exactly
    • Exercises perform correctly
    • No JavaScript errors encountered during operation
  • 6: Has all the major functionality expected of the assignment
    • Demonstrates many techniques from the lesson
    • May deviate from the specified steps in some way
    • Implementation seems more complicated than necessary.
    • May have one minor JavaScript warning or error
  • 4: Has much of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Deviates from the specified steps in some way
    • Implementation seems excessively complicated.
    • May have JavaScript warnings or errors
    • Missing support files
  • 2: Serious functional problems but shows some effort and understanding
    • Follows at least 1/2 of the of the specified steps
    • Has a major error (detected by the browser) or many minor errors
    • Implementation seems very convoluted
    • Demonstrates few techniques from the lesson
  • 0: Does not execute or not turned in

Maximum Score: 20, plus extra credit

What to Turn In

Submit your assignment following the instructions for homework. Create a single zip file with the following:

  1. README.txt file
  2. Your checkout page, named checkout.html
  3. Your JavaScript file, named checkout.js
  4. Your receipt page, named receipt.html
  5. Any other files needed to support your single html page
  6. All the files needed for the Tutorial Case Exercises to work correctly
  7. If you chose to complete the extra credit, then all the files needed for the extra credit to work correctly.

You must submit all the files needed for your assignment to work properly. Do not assume that the instructors has any files. Your assignment must work as submitted.

Home | Blackboard | Announcements | Schedule | Room Policies | Course Info
Help | FAQ's | HowTo's | Links

Last Updated: November 30 2008 @19:42:32