MMDT1022 HTML II and Javascript
Week 6


Week 6

Read chapter 7 in the book.  This chapter is about validating form data. 

In class we will be finishing together this t-shirt order form that we worked on last week and validate some of the data fields to order t-shirts.

Pythex - Python regular expression editor

Regular Expression repository RegExLib

Regular Expression tutorial.

Expresso is a great development tool for regular expressions.


Lab Check Form

Create a contact information update form.  Here is a snapshot of the form and the form variable names.  Also shown is the form action that is called upon submission.  Note:  Pay careful attention to the variable name case.  Variable names are cAsE sEnSiTiVe.

Files to help you get started on the lab.

This is the finished lab called checkform. (Password protected. Only viewable live and in the recording)

Add validation to all textual form elements.  I will be checking the following list very carefully.

  • First Name - Verify first character is a capital letter and that there are 1 to 49 characters (may include spaces and special characters.
  • Last Name - Verify first character is a capital letter and that there are 1 to 49 characters (may include spaces and special characters.
  • Address Line 1 - Verify that there are 1 to 49 characters which may include spaces and special characters.
  • Address Line 2 - Verify that there are 0 to 49 characters which may include spaces and special characters.
  • City - Verify first character is a capital letter and that there are 1 to 49 characters (may include spaces and special characters.
  • State - Verify that it is capitalized two letter state abbreviations as defined by the US Post Office.
  • ZIP - Verify that it is either a 5 digit ZIP code or a 5+4 ZIP code.  Both types of ZIP codes should pass.
  • Phone Number - Verify that it is a legal US phone number.  Allow muliple entering fomats so that the user could enter (320) 555-1212 or 320-555-1212 or 320.555.1212 or even 3205551212.
  • Email - Verify that it is a legal email address.  Remember there are new Top Level Domain (TLD) names that are up to 6 characters long.
  • Year Born - Verify that the year born is from 1900 to 2022 inclusive.
  • Form should not submit if there is an error with one of the fields.

Once built and published, test your form.  All input fields will be echoed back if your form is working correctly.

Grading Criteria Points
30
First Name verified. 2
Last Name verified. 2
Address Line 1 verified. 2
Address Line 2 verified. 1
City verified. 1
State verified. 4
ZIP verified. 4
Phone Number verified. 4
Email verified. 4
Year Born verified. 4
All fields on the form work as shown by submission results page (no nulls). 2

Assignment is due one week from when it was assigned.  50% penalty if late.