Overview

You have created a basic form and added interactivity to images using JavaScript. Now it is time to validate information entered into your form fields. You will use the "registration.html" file found in your Zip file. You will see that the page has a form that has the following fields for allowing users to register for an account. The items in parentheses are defined formatting instructions to be observed for each field.

  • Username* (must only contain letters and numbers).
  • Password* (minimum of 8 characters).
  • PasswordVerify* (minimum of 8 characters, must match password).
  • FirstName* (text string).
  • LastName*( text string).
  • Email (uses xxx@xxx.xxx format).
  • PhoneNumber (uses (xxx) xxx-xxxx format).
  • SignUpNewsletter (radio box for yes/no).

Tips:

  • avaScript is case sensitive so a variable named myVar is different than MyVar and myvar.
  • Perform your form validation testing in pieces at a time rather than all at the end. It will be much easier to fix the error if you have a smaller sequence of code to review.

Directions

Read the assessment overview.

Use the registration.html file to add functionality to the form found on the page. The JavaScript that you write should validate each field and display appropriate error messages (if errors are made) that direct the user to complete the form properly. Once the form is completed, your script should open the confirmation page (confirmation.php).

Note: The input fields in the form with an * are required fields.

Make sure to do the following:

  • Write JavaScript that defines that a field is required and generates an appropriate error message if the field has not been completed.
  • Write JavaScript to validate all input fields per the formatting definitions that the field values should be checked against (found in the overview) after each field.
  • Write JavaScript that displays an appropriate error correction message (next to the field) in the event a form entry error has been made.
  • Write a JavaScript that will default the user's cursor to the first erroneous input field in the event that there is an input error.
  • Create a submit button that executes the validation when submitted.
  • Once completed, view your pages in each of your two selected Web browsers to see if the content renders appropriately and consistently within each. Next, verify that your code is error-free using the appropriate browser-specific development tool found in the Resources. Take a screen capture of each of your validation results and save it for submission.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.