WDD 330: Web Frontend Development II

HTML Forms and User Input Validation

Overview

Forms provide an interface for user input and interaction. They are found all over the internet.

"The <form> HTML element represents a document section containing interactive controls for submitting information." - MDN

Prepare

Activity Instructions

  1. Navigate to this 📑Form example.
  2. Fork the CodePen into your own CodePen account.
  3. Modify the example by:
    1. Adding HTML form validation attributes to the form elements as you see fit, e.g., required.
    2. Adding a field requiring the user to enter the Principle amount again for verification.
    3. Use JavaScript validation to immediately check if the principle amounts match and notify the user and require the principle amounts to be entered again.
    4. Add or modify the code additional to ensure that NaN (Not a Number) output does NOT occur.
  4. Add CSS form element pseudo-classes valid and invalid to visually indicate that individual fields passed validation.