MIS 7375 – Homework 3

Nikki Safarova  |  April 17, 2026

Pseudocode — Page Load & General Behavior

-- Runs automatically when the page loads --

WHEN page loads:
    Display today's date in the header

    Set urgency slider starting value to 1
    WHEN user moves slider → update the number shown next to it

    Hide the Submit button
    WHEN user edits any field → hide Submit button again

    -- Attach live validation to every field --
    FOR EACH text, email, phone, and password field:
        WHEN user types  → validate that field immediately
        WHEN user leaves → validate that field immediately

    FOR EACH dropdown, radio button, and checkbox group:
        WHEN user makes a selection → validate that field immediately

    -- Clear button --
    WHEN user clicks Clear:
        Reset all fields to blank or default values
        Remove all error messages from the screen
        Hide the review panel
        Hide the Submit button
        Hide the password strength bar

Pseudocode — Validate Button

-- Runs when user clicks the Validate button --

WHEN Validate is clicked:

    Check every required field (all checks run so all errors appear at once):

        Check First Name
        Check Middle Initial
        Check Last Name
        Check Gender selection
        Check Date of Birth
        Check Social Security Number
        Check Street Address Line 1
        Check Street Address Line 2
        Check City
        Check State selection
        Check ZIP Code
        Check Email Address
        Check Phone Number
        Check Reason for Visit and Symptom Description
        Check Vaccination Status
        Check Insurance Status
        Check Username
        Check Password
        Check Confirm Password

    IF all 19 checks passed:
        Show the Submit button   → PASS
    ELSE:
        Keep Submit hidden       → one or more fields failed

Pseudocode — Individual Field Rules

First Name / Last Name:
    IF field is empty                    → show error           FAIL
    IF longer than 30 characters         → show error           FAIL
    IF contains digits or symbols        → show error           FAIL
    ELSE                                 → clear error          PASS

Middle Initial:
    IF field is empty                    → clear error          PASS  (optional)
    IF more than 1 character             → show error           FAIL
    IF not a letter                      → show error           FAIL
    ELSE                                 → clear error          PASS

Gender:
    IF no option is selected             → show error           FAIL
    ELSE                                 → clear error          PASS

Date of Birth:
    IF no date entered                   → show error           FAIL
    IF date is in the future             → show error           FAIL
    IF date is more than 120 years ago   → show error           FAIL
    ELSE                                 → clear error          PASS

Social Security Number:
    As user types → automatically insert dashes (e.g. 123-45-6789)
    IF field is empty                    → show error           FAIL
    IF not in format ###-##-####         → show error           FAIL
    ELSE                                 → clear error          PASS

Street Address Line 1:
    IF field is empty                    → show error           FAIL
    IF shorter than 2 or longer than 30  → show error           FAIL
    IF contains disallowed characters    → show error           FAIL
    ELSE                                 → clear error          PASS

Street Address Line 2:
    IF field is empty                    → clear error          PASS  (optional)
    IF shorter than 2 or longer than 30  → show error           FAIL
    IF contains disallowed characters    → show error           FAIL
    ELSE                                 → clear error          PASS

City:
    IF field is empty                    → show error           FAIL
    IF shorter than 2 or longer than 30  → show error           FAIL
    IF contains digits or symbols        → show error           FAIL
    ELSE                                 → clear error          PASS

State:
    IF no state selected from dropdown   → show error           FAIL
    ELSE                                 → clear error          PASS

ZIP Code:
    IF field is empty                    → show error           FAIL
    IF not exactly 5 digits              → show error           FAIL
    ELSE                                 → clear error          PASS

Email Address:
    Convert typed letters to lowercase automatically
    IF field is empty                    → show error           FAIL
    IF not in format name@domain.ext     → show error           FAIL
    ELSE                                 → clear error          PASS

Phone Number:
    As user types → automatically insert dashes (e.g. 123-456-7890)
    IF field is empty                    → show error           FAIL
    IF not in format ###-###-####        → show error           FAIL
    ELSE                                 → clear error          PASS

Reason for Visit (checkboxes) and Symptom Description:
    Checkboxes are optional — no validation required
    IF symptom description is empty      → clear error          PASS  (optional)
    IF description is longer than 500 characters → show error  FAIL
    IF description contains HTML code   → show error           FAIL
    ELSE                                 → clear error          PASS

Vaccination Status / Insurance Status:
    IF no Yes/No option is selected      → show error           FAIL
    ELSE                                 → clear error          PASS

Username:
    Convert typed letters to lowercase automatically
    IF field is empty                    → show error           FAIL
    IF first character is not a letter   → show error           FAIL
    IF shorter than 5 or longer than 30  → show error           FAIL
    IF contains spaces or special symbols → show error          FAIL
    ELSE                                 → clear error          PASS

Password:
    IF field is empty                    → show error           FAIL
    IF shorter than 8 characters         → show error           FAIL
    IF no uppercase letter               → show error           FAIL
    IF no lowercase letter               → show error           FAIL
    IF no number                         → show error           FAIL
    IF password contains username, first name, or last name
                                         → show error           FAIL
    ELSE                                 → clear error          PASS
        IF Confirm Password is already filled in → re-check it

Confirm Password:
    IF field is empty                    → show error           FAIL
    IF does not match Password           → show error           FAIL
    ELSE                                 → clear error          PASS

Pseudocode — Password Strength Meter

-- Runs on every keystroke in the Password field --

WHEN user types in the Password field:

    IF field is empty → hide strength bar and label, stop

    Show the strength bar
    Start with a score of 0

    IF password is at least 8 characters long   → add 1 point
    IF password is at least 12 characters long  → add 1 point
    IF password contains an uppercase letter    → add 1 point
    IF password contains a lowercase letter     → add 1 point
    IF password contains a number              → add 1 point
    IF password contains a special character    → add 1 point

    IF score is 0–2  → show bar at 33%,  color red,    label "Weak"
    IF score is 3–4  → show bar at 66%,  color orange, label "Medium"
    IF score is 5–6  → show bar at 100%, color green,  label "Strong"
← Registration Form ← Synopsis